We have DB link with Postgres 16. Data is being fetched from remote table perfectly fine. But when CTAS is used to insert data into local table, it throws multiple errors;
Even it impacts other connected sessions from other users and those jobs get failed as well.
SELECT dblink_connect('myconn', 'host=10.x.x.x port=5434 dbname=afiniti user=postgres password=xxxxxxxx')
Following query is causing issue:
DROP TABLE IF EXISTS stage_aunits_test;
CREATE TEMP TABLE stage_aunits_test AS
SELECT *
FROM dblink('myconn', 'SELECT modelunit_id, program_id, app, active_datetime FROM public.aunits') AS
remote(
modelunit_id integer,
program_id integer,
app varchar,
active_datetime timestamp
);
PL/pgSQL function ai_cg_not() line 72 during statement block local variable initialization","SELECT * FROM ai_cg_not()",0,,"COptTasks.cpp",267,
2026-05-15 06:33:04.824219 EDT,"MxxxAxxPxxx","gpafiniti",p96483,th2275520,"10.x.x.x","47864",2026-05-15 06:33:04 EDT,165637,con12,cmd4,seg-1,,dx1344078,x165637,sx1,"ERROR","42883","function dblink_connect(unknown, unknown) does not exist",,"No function matches the given name and argument types. You might need to add explicit type casts.","SELECT dblink_connect('myconn', 'host=10.x.x.x port=5434 dbname=afiniti user=postgres password=xxxxxxxx')",8,"PL/pgSQL function ai_cg_not() line 83 at PERFORM","SELECT * FROM ai_cg_not()",0,,"parse_func.c",637
2026-05-15 06:33:04.782006 EDT,"MxxxAxxPxxx","gpafiniti",p96483,th2275520,"10.32.x.x","47864",2026-05-15 06:33:04 EDT,0,con12,cmd4,seg-1,,dx1344078,,sx1,"LOG","00000","2026-05-15 06:33:04:781846 EDT,THD000,NOTICE,""Falling back to Postgres-based planner because GPORCA does not support the following feature: {SQLVALUEFUNCTION :op 0 :type 1082 :typmod -1 :location 0}"",
",,,,,"SQL expression ""current_date""
We have DB link with Postgres 16. Data is being fetched from remote table perfectly fine. But when CTAS is used to insert data into local table, it throws multiple errors;
Even it impacts other connected sessions from other users and those jobs get failed as well.
SELECT dblink_connect('myconn', 'host=10.x.x.x port=5434 dbname=afiniti user=postgres password=xxxxxxxx')
Following query is causing issue:
DROP TABLE IF EXISTS stage_aunits_test;
CREATE TEMP TABLE stage_aunits_test AS
SELECT *
FROM dblink('myconn', 'SELECT modelunit_id, program_id, app, active_datetime FROM public.aunits') AS
remote(
modelunit_id integer,
program_id integer,
app varchar,
active_datetime timestamp
);
PL/pgSQL function ai_cg_not() line 72 during statement block local variable initialization","SELECT * FROM ai_cg_not()",0,,"COptTasks.cpp",267,
2026-05-15 06:33:04.824219 EDT,"MxxxAxxPxxx","gpafiniti",p96483,th2275520,"10.x.x.x","47864",2026-05-15 06:33:04 EDT,165637,con12,cmd4,seg-1,,dx1344078,x165637,sx1,"ERROR","42883","function dblink_connect(unknown, unknown) does not exist",,"No function matches the given name and argument types. You might need to add explicit type casts.","SELECT dblink_connect('myconn', 'host=10.x.x.x port=5434 dbname=afiniti user=postgres password=xxxxxxxx')",8,"PL/pgSQL function ai_cg_not() line 83 at PERFORM","SELECT * FROM ai_cg_not()",0,,"parse_func.c",637
2026-05-15 06:33:04.782006 EDT,"MxxxAxxPxxx","gpafiniti",p96483,th2275520,"10.32.x.x","47864",2026-05-15 06:33:04 EDT,0,con12,cmd4,seg-1,,dx1344078,,sx1,"LOG","00000","2026-05-15 06:33:04:781846 EDT,THD000,NOTICE,""Falling back to Postgres-based planner because GPORCA does not support the following feature: {SQLVALUEFUNCTION :op 0 :type 1082 :typmod -1 :location 0}"",
",,,,,"SQL expression ""current_date""