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

From Alexander Farber
Subject Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1
Date
Msg-id CAADeyWjt_i53mD+6mUA8kW2bD-LCmQFfWUNJfUSuns8YjpuJzA@mail.gmail.com
Whole thread Raw
In response to Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-general
Thank you Craig, this has worked in my custom function too:

BEGIN
        PERFORM check_positions(in_uid, in_gid, in_tiles);

        CREATE TEMP TABLE _words ON COMMIT DROP AS
        SELECT
                out_word AS word,
                max(out_score) AS score
        FROM check_words(in_uid, in_gid, in_tiles)
        GROUP BY word, gid;

PL/pgSQL is weird, but fun :-) 

I like that I can RAISE EXCEPTION in my custom function and PostgreSQL rolls everything back.

Regards
Alex

pgsql-general by date:

Previous
From: Ioana Danes
Date:
Subject: Re: Corrupted Data ?
Next
From: James Sewell
Date:
Subject: Critical failure of standby