Re: WIP: CREATE TABLE AS / WITH DATA - Mailing list pgsql-patches

From Neil Conway
Subject Re: WIP: CREATE TABLE AS / WITH DATA
Date
Msg-id 1096244591.25688.706.camel@localhost.localdomain
Whole thread Raw
In response to Re: WIP: CREATE TABLE AS / WITH DATA  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-patches
On Wed, 2004-09-22 at 23:00, Alvaro Herrera wrote:
> Could that include supporting SELECT INTO as well as both types of
> CREATE TABLE AS?  I remember being annoyed by some limitation of one of
> the forms ...

I'm working on implementing this (and Tom's suggestion of creating a new
DestReceiver), and I should have something worth sending to -patches in
a few days.

One note on the implementation: I had originally wanted to distinguish
between SELECT and SELECT INTO in the parser, so that the SelectStmt
parse node could be kept entirely free of SELECT INTO-related detritus.
I wasn't able to figure out how to do this, though: we want to allow
only the left-most SELECT in a set operation tree to contain an INTO
clause. For now, I've settled for keeping an "into" field in SelectStmt,
and transforming SelectStmt -> CreateTableAsStmt in parser/analyze.c if
appropriate. That means you could send a SelectStmt into the analysis
phase and get a utility statement back, but I don't see that as a
problem. Can anyone see a cleaner way to implement this?

-Neil



pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: [HACKERS] cvsup
Next
From: Peter Eisentraut
Date:
Subject: Re: plpython win32