Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fa2356a

Browse files
committed
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.
1 parent dec4ed3 commit fa2356a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/bin/psql/describe.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.85 2003/09/07 03:43:53 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.86 2003/10/17 00:57:04 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -986,9 +986,11 @@ describeOneTableDetails(const char *schemaname,
986986
if (tableinfo.checks)
987987
{
988988
printfPQExpBuffer(&buf,
989-
"SELECT consrc, conname\n"
989+
"SELECT "
990+
"pg_catalog.pg_get_constraintdef(r.oid, true), "
991+
"conname\n"
990992
"FROM pg_catalog.pg_constraint r\n"
991-
"WHERE r.conrelid = '%s' AND r.contype = 'c'",
993+
"WHERE r.conrelid = '%s' AND r.contype = 'c'",
992994
oid);
993995
result2 = PSQLexec(buf.data, false);
994996
if (!result2)
@@ -1119,7 +1121,7 @@ describeOneTableDetails(const char *schemaname,
11191121
footers[count_footers++] = xstrdup(buf.data);
11201122
for (i = 0; i < check_count; i++)
11211123
{
1122-
printfPQExpBuffer(&buf, _(" \"%s\" CHECK %s"),
1124+
printfPQExpBuffer(&buf, _(" \"%s\" %s"),
11231125
PQgetvalue(result2, i, 1),
11241126
PQgetvalue(result2, i, 0));
11251127

0 commit comments

Comments
 (0)