mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-07 19:47:50 +08:00
Make psql distinguish between unique indices and unique constraints.
Josh Kupershmidt. Reviewing and kibitzing by Kevin Grittner and me.
This commit is contained in:
parent
b8c798ebc5
commit
afc2900ffd
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.242 2010/07/06 19:18:59 momjian Exp $
|
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.243 2010/08/01 01:08:29 rhaas Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -1592,7 +1592,12 @@ describeOneTableDetails(const char *schemaname,
|
|||||||
if (strcmp(PQgetvalue(result, i, 1), "t") == 0)
|
if (strcmp(PQgetvalue(result, i, 1), "t") == 0)
|
||||||
appendPQExpBuffer(&buf, " PRIMARY KEY,");
|
appendPQExpBuffer(&buf, " PRIMARY KEY,");
|
||||||
else if (strcmp(PQgetvalue(result, i, 2), "t") == 0)
|
else if (strcmp(PQgetvalue(result, i, 2), "t") == 0)
|
||||||
appendPQExpBuffer(&buf, " UNIQUE,");
|
{
|
||||||
|
if (strcmp(PQgetvalue(result, i, 7), "u") == 0)
|
||||||
|
appendPQExpBuffer(&buf, " UNIQUE CONSTRAINT,");
|
||||||
|
else
|
||||||
|
appendPQExpBuffer(&buf, " UNIQUE,");
|
||||||
|
}
|
||||||
|
|
||||||
/* Everything after "USING" is echoed verbatim */
|
/* Everything after "USING" is echoed verbatim */
|
||||||
indexdef = PQgetvalue(result, i, 5);
|
indexdef = PQgetvalue(result, i, 5);
|
||||||
|
@ -55,7 +55,7 @@ NOTICE: CREATE TABLE / UNIQUE will create implicit index "persons2_name_key" fo
|
|||||||
name | text |
|
name | text |
|
||||||
Indexes:
|
Indexes:
|
||||||
"persons2_pkey" PRIMARY KEY, btree (id)
|
"persons2_pkey" PRIMARY KEY, btree (id)
|
||||||
"persons2_name_key" UNIQUE, btree (name)
|
"persons2_name_key" UNIQUE CONSTRAINT, btree (name)
|
||||||
Typed table of type: person_type
|
Typed table of type: person_type
|
||||||
|
|
||||||
CREATE TABLE persons3 OF person_type (
|
CREATE TABLE persons3 OF person_type (
|
||||||
|
Loading…
Reference in New Issue
Block a user