I have a large application that connects to SQL Server and makes extensive use of temporary tables using the #table syntax. I would like to convert this to connect to postgres, which does not accept that notation. Is there a work-around, other than modifying all my code?
Postgres supports temporary tables but it does not support the #tablename syntax. You can keep the structure but you will have to modify the code to the new syntax. Unless you want to download the code for Postgres and modify that but that seems like unrecommended overkill.
CREATE TEMPORARY TABLE statement creates a temporary table that is automatically dropped at the end of a session, or the current transaction (ON COMMIT DROP option).
-- Create a temporary table CREATE TEMPORARY TABLE temp_location ( city VARCHAR(80), street VARCHAR(80) ) ON COMMIT DELETE ROWS;