Re: CREATE FOREGIN TABLE LACUNA - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: CREATE FOREGIN TABLE LACUNA
Date
Msg-id 1331821220-sup-36@alvh.no-ip.org
Whole thread Raw
In response to Re: CREATE FOREGIN TABLE LACUNA  (David Fetter <david@fetter.org>)
Responses Re: CREATE FOREGIN TABLE LACUNA  (David Fetter <david@fetter.org>)
Re: CREATE FOREGIN TABLE LACUNA  (Robert Haas <robertmhaas@gmail.com>)
Re: CREATE FOREGIN TABLE LACUNA  (David Fetter <david@fetter.org>)
Re: CREATE FOREGIN TABLE LACUNA  (David Fetter <david@fetter.org>)
List pgsql-hackers
Excerpts from David Fetter's message of jue mar 15 02:28:28 -0300 2012:
> On Wed, Mar 14, 2012 at 12:06:20PM -0400, Robert Haas wrote:
> > On Wed, Mar 14, 2012 at 10:22 AM, David Fetter <david@fetter.org> wrote:
> > >> I think that instead of inventing new grammar productions and a new
> > >> node type for this, you should just reuse the existing productions for
> > >> LIKE clauses and then reject invalid options during parse analysis.
> > >
> > > OK.  Should I first merge CREATE FOREIGN TABLE with CREATE TABLE and
> > > submit that as a separate patch?
> >
> > I don't see any reason to do that.  I merely meant that you could
> > reuse TableLikeClause or maybe even TableElement in the grammer for
> > CreateForeignTableStmt.
>
> Next WIP patch attached implementing this via reusing TableLikeClause
> and refactoring transformTableLikeClause().
>
> What say?

Looks much better to me, but the use of strcmp() doesn't look good.
ISTM that stmtType is mostly used for error messages.  I think you
should add some kind of identifier (such as the original parser Node)
into the CreateStmtContext so that you can do a IsA() test instead -- a
bit more invasive as a patch, but much cleaner.

Also the error messages need more work.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: libpq should have functions for escaping data for use in COPY FROM
Next
From: Alvaro Herrera
Date:
Subject: Re: Another review of URI for libpq, v7 submission