Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitafc2900

Browse files
committed
Make psql distinguish between unique indices and unique constraints.
Josh Kupershmidt. Reviewing and kibitzing by Kevin Grittner and me.
1 parentb8c798e commitafc2900

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎src/bin/psql/describe.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
1010
*
11-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.242 2010/07/06 19:18:59 momjian Exp $
11+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.243 2010/08/01 01:08:29 rhaas Exp $
1212
*/
1313
#include"postgres_fe.h"
1414

@@ -1592,7 +1592,12 @@ describeOneTableDetails(const char *schemaname,
15921592
if (strcmp(PQgetvalue(result,i,1),"t")==0)
15931593
appendPQExpBuffer(&buf," PRIMARY KEY,");
15941594
elseif (strcmp(PQgetvalue(result,i,2),"t")==0)
1595-
appendPQExpBuffer(&buf," UNIQUE,");
1595+
{
1596+
if (strcmp(PQgetvalue(result,i,7),"u")==0)
1597+
appendPQExpBuffer(&buf," UNIQUE CONSTRAINT,");
1598+
else
1599+
appendPQExpBuffer(&buf," UNIQUE,");
1600+
}
15961601

15971602
/* Everything after "USING" is echoed verbatim */
15981603
indexdef=PQgetvalue(result,i,5);

‎src/test/regress/expected/typed_table.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ NOTICE: CREATE TABLE / UNIQUE will create implicit index "persons2_name_key" fo
5555
name | text |
5656
Indexes:
5757
"persons2_pkey" PRIMARY KEY, btree (id)
58-
"persons2_name_key" UNIQUE, btree (name)
58+
"persons2_name_key" UNIQUE CONSTRAINT, btree (name)
5959
Typed table of type: person_type
6060

6161
CREATE TABLE persons3 OF person_type (

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp