From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1 |
Date: | 2016-08-12 09:07:47 |
Message-ID: | CAECtzeWV1vDRGviZBKiJDxypWds-JbhjteuYe1o5rX2S62MVPg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2016-08-12 11:00 GMT+02:00 Alexander Farber <alexander(dot)farber(at)gmail(dot)com>:
> Francisco, thanks, but -
>
> On Fri, Aug 12, 2016 at 10:47 AM, Francisco Olarte <folarte(at)peoplecall(dot)com
> > wrote:
>
>>
>> https://www.postgresql.org/docs/9.5/static/plpgsql-statement
>> s.html#PLPGSQL-STATEMENTS-SQL-ONEROW
>>
>>
> 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...
--
Guillaume.
http://blog.guillaume.lelarge.info
http://www.dalibo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Andrus | 2016-08-12 09:18:44 | Re: How to parse xml containing optional elements |
Previous Message | Chris Travers | 2016-08-12 09:07:08 | Re: Postgres Pain Points 2 ruby / node language drivers |