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.
This commit is contained in:
parent
dec4ed311a
commit
fa2356a1ac
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
* 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 "postgres_fe.h"
|
||||||
#include "describe.h"
|
#include "describe.h"
|
||||||
|
@ -986,9 +986,11 @@ describeOneTableDetails(const char *schemaname,
|
||||||
if (tableinfo.checks)
|
if (tableinfo.checks)
|
||||||
{
|
{
|
||||||
printfPQExpBuffer(&buf,
|
printfPQExpBuffer(&buf,
|
||||||
"SELECT consrc, conname\n"
|
"SELECT "
|
||||||
|
"pg_catalog.pg_get_constraintdef(r.oid, true), "
|
||||||
|
"conname\n"
|
||||||
"FROM pg_catalog.pg_constraint r\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);
|
oid);
|
||||||
result2 = PSQLexec(buf.data, false);
|
result2 = PSQLexec(buf.data, false);
|
||||||
if (!result2)
|
if (!result2)
|
||||||
|
@ -1119,7 +1121,7 @@ describeOneTableDetails(const char *schemaname,
|
||||||
footers[count_footers++] = xstrdup(buf.data);
|
footers[count_footers++] = xstrdup(buf.data);
|
||||||
for (i = 0; i < check_count; i++)
|
for (i = 0; i < check_count; i++)
|
||||||
{
|
{
|
||||||
printfPQExpBuffer(&buf, _(" \"%s\" CHECK %s"),
|
printfPQExpBuffer(&buf, _(" \"%s\" %s"),
|
||||||
PQgetvalue(result2, i, 1),
|
PQgetvalue(result2, i, 1),
|
||||||
PQgetvalue(result2, i, 0));
|
PQgetvalue(result2, i, 0));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue