Re: SELECT col INTO TEMP TABLE tab2 ON COMMIT DROP FROM tab1

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: 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 17:28:50
Message-ID: CAADeyWjt_i53mD+6mUA8kW2bD-LCmQFfWUNJfUSuns8YjpuJzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2016-08-12 18:15:10 Re: Critical failure of standby
Previous Message Ioana Danes 2016-08-12 17:20:32 Re: Corrupted Data ?