Re: Command Triggers, patch v11 - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Command Triggers, patch v11
Date
Msg-id m2ty1loha4.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: Command Triggers, patch v11  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Command Triggers, patch v11  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> 1. ExecuteQuery still has to know that's a CREATE TABLE AS operation so
> that it can enforce that the prepared query is a SELECT.  (BTW, maybe
> this should be weakened to "something that returns tuples", in view of
> RETURNING?)

That lights a bulb: what about rewriting CREATE TABLE AS as two
commands, internally:
1. CREATE TABLE …2. WITH x ( <query here> ) INSERT INTO … SELECT * FROM x;

It seems like not solving much from a practical point of view though as
you need to be able to parse the output of the subquery before you can
do the first step, but on the other hand it might be that you already
have the pieces to just do that.

Well, I had to share that though, somehow.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Command Triggers, patch v11
Next
From: Peter Eisentraut
Date:
Subject: Re: Command Triggers, patch v11