SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1
Date: 2016-08-12 08:41:34
Message-ID: CAADeyWiFBXbeOEA9HNMCrouqJ6FEw5Aph8=o3HWRYSw41WMqJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Good morning,

why does this syntax fail in 9.5.3 please?

I am trying to call 2 custom functions from a third one with:

CREATE OR REPLACE FUNCTION play_game(
IN in_uid integer,
IN in_gid integer,
IN in_tiles jsonb,
OUT out_gid integer)
RETURNS integer AS
$func$
DECLARE
....
BEGIN
PERFORM check_positions(in_uid, in_gid, in_tiles);

SELECT
out_word AS word,
max(out_score) AS score
INTO TEMP TABLE _words ON COMMIT DROP
FROM check_words(in_uid, in_gid, in_tiles)
GROUP BY word, gid;
...
END
$func$ LANGUAGE plpgsql;

But get the errors (I tried TEMP, TEMPORARY, with and without TABLE):

words=> \i play_game.sql
psql:play_game.sql:166: ERROR: "temp" is not a known variable
LINE 29: INTO TEMP TABLE _words ON COMMIT DROP
^

words=> \i play_game.sql
psql:play_game.sql:166: ERROR: "temporary" is not a known variable
LINE 29: INTO TEMPORARY TABLE _words ON COMMIT DROP
^

The doc https://www.postgresql.org/docs/9.5/static/sql-selectinto.html just
says:
" read the doc
https://www.postgresql.org/docs/9.5/static/sql-createtable.html "

Thank you
Alex

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2016-08-12 08:47:52 Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1
Previous Message Chris Travers 2016-08-12 08:33:19 Re: Postgres Pain Points 2 ruby / node language drivers