I am having issues with the below query. It worked prior to me adding attribute_4 and attribute_5. When I added attribute_4 and attribute_5, it is now giving me the below error ERROR: remote query result rowtype does not match the specified FROM clause rowtype
Any suggestions? (also the host port has been removed and replaced with the word removed for integrity.
INSERT INTO tokens_12345 (
firstname,
lastname,
email,
attribute_2,
attribute_3,
attribute_1,
attribute_9,
attribute_11,
attribute_12,
attribute_13,
attribute_14,
attribute_10,
attribute_15,
attribute_4,
attribute_5,
attribute_6,
attribute_7,
attribute_8,
token
) SELECT
*
FROM
dblink (
'removed',
'SELECT "CM_fname" AS firstname,
"CM_lname" AS lastname,
''none@email.com''::VARCHAR AS email,
gender_code AS attribute_2,
"CM_title" AS attribute_3,
cm_age_bracket_code AS attribute_1,
"CITY" AS attribute_4,
waterdistrict_code AS attribute_5,
"CM_file_id" AS attribute_9,
hh_fname1 AS attribute_11,
hh_fname2 AS attribute_12,
hh_fname3 AS attribute_13,
hh_fname4 AS attribute_14,
group_id AS attribute_10,
hh_phone AS attribute_15,
'''',
'''',
CASE '''' WHEN ''CA'' THEN ''Katie Porter'' WHEN ''MN'' THEN ''Dean Phillips'' WHEN ''TX'' THEN ''Gina Ortiz Jones'' ELSE '''' END,
cm_age_bracket,"GENDER",
"CM_id_num" AS token
from "in_load1_all" WHERE hh_phone is not null'
) AS
A (firstname varchar(150),
lastname varchar(150),
email text,
attribute_2 text,
attribute_3 text,
attribute_1 text,
attribute_9 text,
attribute_11 text,
attribute_12 text,
attribute_13 text,
attribute_14 text,
attribute_10 text,
attribute_15 text,
attribute_4 text,
attribute_5 text,
attribute_6 text,
attribute_7 text,
attribute_8 text,
token varchar(35)
);