Table variables in SQL Server live in session memory and disappear when the batch ends. PostgreSQL has no direct equivalent — choose between a temp table or a CTE.
CREATE TEMP TABLE (most common substitute)
SQL Server
DECLARE @tmp TABLE (id int, name text); INSERT INTO @tmp VALUES (1, 'A');
PostgreSQL
CREATE TEMP TABLE tmp (id int, name text) ON COMMIT PRESERVE ROWS; INSERT INTO tmp VALUES (1, 'A');