Re: Review: Non-inheritable check constraints

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Greg Smith <greg(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: Non-inheritable check constraints
Date: 2011-12-16 20:50:12
Message-ID: CAFaPBrT=86iA2fCc2pe2LwpDORLz5PjqjvEyi8NTN1TEF5kizA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 16, 2011 at 12:06, Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:

> Yeah.  Nikhil, Alex, this is the merged patch.  Have a look that it
> still works for you (particularly the pg_dump bits) and I'll commit it.
> I adjusted the regression test a bit too.

Other than the version checks seem to be off by one looks fine. I
assume I/we missed that in the original patch. I also adjusted the
version check in describe.c to be consistent with the other version
checks in that file (>= 90200 instead of > 90100).

(Also, nice catch on "false AS as r.conisonly" in describe.c)

--

*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
***************
*** 5996,6003 **** getTableAttrs(TableInfo *tblinfo, int numTables)
tbinfo->dobj.name);

resetPQExpBuffer(q);
! if (g_fout->remoteVersion >= 90100)
{
appendPQExpBuffer(q, "SELECT tableoid, oid, conname, "
"pg_catalog.pg_get_constraintdef(oid) AS consrc, "
"conislocal, convalidated, conisonly "
--- 5996,6004 ----
tbinfo->dobj.name);

resetPQExpBuffer(q);
! if (g_fout->remoteVersion >= 90200)
{
+ /* conisonly is new in 9.2 */
appendPQExpBuffer(q, "SELECT tableoid, oid, conname, "
"pg_catalog.pg_get_constraintdef(oid) AS consrc, "
"conislocal, convalidated, conisonly "
***************
*** 6007,6012 **** getTableAttrs(TableInfo *tblinfo, int numTables)
--- 6008,6026 ----
"ORDER BY conname",
tbinfo->dobj.catId.oid);
}
+ else if (g_fout->remoteVersion >= 90100)
+ {
+ /* conisvalidated is new in 9.1 */
+ appendPQExpBuffer(q, "SELECT tableoid, oid, conname, "
+ "pg_catalog.pg_get_constraintdef(oid) AS consrc, "
+ "conislocal, convalidated, "
+ "false as conisonly "
+ "FROM pg_catalog.pg_constraint "
+ "WHERE conrelid = '%u'::pg_catalog.oid "
+ " AND contype = 'c' "
+ "ORDER BY conname",
+ tbinfo->dobj.catId.oid);
+ }
else if (g_fout->remoteVersion >= 80400)
{
appendPQExpBuffer(q, "SELECT tableoid, oid, conname, "
*** a/src/bin/psql/describe.c
--- b/src/bin/psql/describe.c
***************
*** 1783,1789 **** describeOneTableDetails(const char *schemaname,
{
char *is_only;

! if (pset.sversion > 90100)
is_only = "r.conisonly";
else
is_only = "false AS conisonly";
--- 1783,1789 ----
{
char *is_only;

! if (pset.sversion >= 90200)
is_only = "r.conisonly";
else
is_only = "false AS conisonly";

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-12-16 21:01:56 Re: Review: Non-inheritable check constraints
Previous Message Jim Nasby 2011-12-16 20:42:37 Re: WIP: cross column stats revisited ...