Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1 - Mailing list pgsql-general

From Guillaume Lelarge
Subject Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1
Date
Msg-id CAECtzeWV1vDRGviZBKiJDxypWds-JbhjteuYe1o5rX2S62MVPg@mail.gmail.com
Whole thread Raw
In response to Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1  (Alexander Farber <alexander.farber@gmail.com>)
Responses Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1  (Alexander Farber <alexander.farber@gmail.com>)
List pgsql-general
2016-08-12 11:00 GMT+02:00 Alexander Farber <alexander.farber@gmail.com>:
Francisco, thanks, but -
but the custom function I am trying to call (from another function) does not return one row, but several rows, which I'd like to store into a temp table:

        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;


Francisco is right. SELECT INTO doesn't have the same meaning in SQL and PL/pgsql. If you want to insert the result of the SELECT into a temporary table, create the temp table and insert into it:

CREATE TEMP TABLE...
INSERT INTO your_temp_table SELECT...


--

pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: Re: Postgres Pain Points 2 ruby / node language drivers
Next
From: "Andrus"
Date:
Subject: Re: How to parse xml containing optional elements