Good morning,
why does this syntax fail in 9.5.3 please?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;
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;
$func$ LANGUAGE plpgsql;
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
^
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 "
" read the doc https://www.postgresql.org/docs/9.5/static/sql-createtable.html "