From: Tom Lane Date: Fri, 17 Oct 2003 00:57:04 +0000 (+0000) Subject: Use pg_get_constraintdef() rather than pg_constraint.consrc; this is X-Git-Tag: REL7_4_BETA5~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa2356a1acd4fab20c66079747cf856441cc9546;p=postgresql Use pg_get_constraintdef() rather than pg_constraint.consrc; this is a portion of a patch recently submitted by Christopher Kings-Lynne. Applied by agreement that this is a bug fix. --- diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index fa1743f100..9db5dad3da 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2003, PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.85 2003/09/07 03:43:53 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.86 2003/10/17 00:57:04 tgl Exp $ */ #include "postgres_fe.h" #include "describe.h" @@ -986,9 +986,11 @@ describeOneTableDetails(const char *schemaname, if (tableinfo.checks) { printfPQExpBuffer(&buf, - "SELECT consrc, conname\n" + "SELECT " + "pg_catalog.pg_get_constraintdef(r.oid, true), " + "conname\n" "FROM pg_catalog.pg_constraint r\n" - "WHERE r.conrelid = '%s' AND r.contype = 'c'", + "WHERE r.conrelid = '%s' AND r.contype = 'c'", oid); result2 = PSQLexec(buf.data, false); if (!result2) @@ -1119,7 +1121,7 @@ describeOneTableDetails(const char *schemaname, footers[count_footers++] = xstrdup(buf.data); for (i = 0; i < check_count; i++) { - printfPQExpBuffer(&buf, _(" \"%s\" CHECK %s"), + printfPQExpBuffer(&buf, _(" \"%s\" %s"), PQgetvalue(result2, i, 1), PQgetvalue(result2, i, 0));