What is the equivalent for a SQL Server global temporary table in Postgresql?

Viewed 260

While migrating a stored procedure from T-SQL to postgresql I came across a blocker i.e the data is fetched from ##undolog tables. Now, I am facing problem to migrate it to Postgresql. Below is the simple query of undolog.

SELECT 1 
FROM ##UndoLog
WHERE UndoAction = 3 AND TabName = @TabName AND PK_data = vPK_data;

How do I rewrite the query in postgresql?

1 Answers

check the extension PostgreSQL Global Temporary Tables

pgtt is a PostgreSQL extension to create, manage and use Oracle-style Global Temporary Tables.

The main interest of this extension is to reproduce Oracle behavior with GTT when you can not or don't want to rewrite the application code when migrating to PostgreSQL. In all other case best is to rewrite the code to use standard PostgreSQL temporary tables.

https://github.com/darold/pgtt/releases/

Related