Re: Constraint documentation

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Lætitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>
Cc: peter(dot)eisentraut(at)2ndquadrant(dot)com, bpd0018(at)gmail(dot)com, vik(dot)fearing(at)2ndquadrant(dot)com, coelho(at)cri(dot)ensmp(dot)fr, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Constraint documentation
Date: 2018-08-09 21:32:03
Message-ID: 20180809213203.i2ayhswvcleedbss@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2018-Aug-07, Lætitia Avrot wrote:

> Hi Peter,
> I understand what you're pointing at and I agree that it could be a good
> thing to be able to dump/restore a table without problem.
> My point was that check constraints weren't supposed to be used that way
> theorically (or maybe i'm mistaken ?) so I thought maybe we should just
> inform the user that this kind of use of a check constraint is a misuse of
> that feature.

Tom Lane pointed out in another thread that the SQL standard lists
feature F673 "Reads SQL-data routine invocations in CHECK constraints"
which permits CHECK constraints to examine tables, so saying "you're not
supposed to do this", while correct from a Postgres perspective, would
be short-sighted ISTM, because we will make ourselves liars as soon as
we implement the feature.

I agree that we should point this out in *some* way, just not sure how.
Maybe something like "Postgres does not currently support CHECK
constraints containing queries, therefore we recommend to avoid them."
I would not mention pg_dump by name, just say dumps may not restore
depending on phase of moon.

(BTW I'm not sure of the term "other tables". You could have a query
that references the same table ...)

Álvaro Herrera
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Finzel 2018-08-09 21:34:55 Repeatable Read Isolation in SQL running via background worker
Previous Message Bear Giles 2018-08-09 20:34:07 Re: [FEATURE REQUEST] Encrypted indexes over encrypted data