Re: CREATE FOREGIN TABLE LACUNA

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE FOREGIN TABLE LACUNA
Date: 2012-03-14 12:53:17
Message-ID: CA+TgmoZAiknWYZ=4uOTRzAF_-PWy99b5=trXSkDwy9s15N=zVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 14, 2012 at 8:28 AM, David Fetter <david(at)fetter(dot)org> wrote:
> On Tue, Mar 13, 2012 at 08:24:47AM -0700, David Fetter wrote:
>> Folks,
>>
>> This is for 9.3, of course.
>>
>> I noticed that CREATE FOREIGN TABLE (LIKE some_table) doesn't work.  I
>> believe it should, as it would:
>>
>> - Remove a POLA violation
>> - Make data loading into an extant table even easier, especially if
>>   there need to be filtering or other cleanup steps
>>
>> Come to think of it, which CREATE TABLE options are inappropriate to
>> CREATE FOREIGN TABLE?
>
> Here's a WIP patch (lots of cut/paste, no docs, no tests), but it does
> work.  Still to do in addition: decide whether ALTER FOREIGN TABLE
> should also handle LIKE.

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.
INCLUDING COMMENTS would be OK, but the the rest are no good.

I'd actually like to see us allow foreign tables to have constraints.
Obviously, we can't enforce constraints on remote data, but the point
would be allow the system administrator to supply the query planner
with enough knowledge to make constraint exclusion work. The fact
that you can't make that work today is a major gap, IMV.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-03-14 12:56:26 Re: Command Triggers, patch v11
Previous Message Robert Haas 2012-03-14 12:41:00 Re: pg_prewarm