Re: NOT NULL constraints in foreign tables

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NOT NULL constraints in foreign tables
Date: 2012-08-17 20:08:25
Message-ID: 1345233328-sup-9446@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Robert Haas's message of vie ago 17 15:44:29 -0400 2012:
> On Fri, Aug 17, 2012 at 2:58 PM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
> > I mean, what are NOT NULL in foreign tables for? Are they harmed or
> > helped by having pg_constraint rows?
>
> As I've mentioned when this has come up before, I think that
> constraints on foreign tables should be viewed as declarative
> statements about the contents of the foreign data that the DB will
> assume true. This could be useful for a variety of purposes:
> constraint exclusion, query optimization, etc.

So pg_constraint rows for NOT NULLs are a good thing, right?

In general, it seems to me that you're saying we should just lift the
DefineRelation-enforced restriction that foreign tables ought not to
have constraints. So if the user wants to specify

CREATE FOREIGN TABLE people (
who person CHECK (who IS OF TYPE 'human'),
..
) server foobar;

we ought to let them. Correct?

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-08-17 20:23:52 Re: foreign key locks
Previous Message Ross Reedstrom 2012-08-17 20:08:07 Re: feature request: auto savepoint for interactive psql when in transaction.