This script works fine when running on dbeaver, I can work with the new created temp table:
SELECT someField
INTO TEMP tmp_TableZZ
FROM "_fdw_xxx".myTable;
But when inside a stored procedure, I got this error message:
SQL Error [42601]: ERROR: "temp" is not a known variable
Same code:
CREATE OR REPLACE procedure PopulateSomething()
LANGUAGE plpgsql
AS $procedure$
DECLARE v_ReportDte date;
begin
--some code omitted
SELECT someField
INTO TEMP tmp_TableZZ
FROM "_fdw_xxx".myTable;
--some code omitted
end; $procedure$
;
Using TEMPORARY
instead of TEMP
got the same result.