Search Postgresql Archives

SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux