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

Commitb1953e6

Browse files
committed
Improve ordering for \dAo and \dAp psql commands
This commit changes ORDER BY clause for \dAo and \dAp psql commands inthe following way. * Operators for the same types are grouped together. * Same-class operators and procedures are listed before cross-class operators and procedures.Modification of ORDER BY clause for \dAp required removing DISTINCT clause,which doesn't seem to affect anything.Discussion:https://postgr.es/m/20200511210856.GA18368%40alvherre.pgsqlAuthor: Alvaro Herrera revised by meReviewed-by: Alexander Korotkov, Nikita Glukhov
1 parenteeba6c7 commitb1953e6

File tree

3 files changed

+49
-25
lines changed

3 files changed

+49
-25
lines changed

‎src/bin/psql/describe.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6288,7 +6288,11 @@ listOpFamilyOperators(const char *access_method_pattern,
62886288
processSQLNamePattern(pset.db,&buf,family_pattern,have_where, false,
62896289
"nsf.nspname","of.opfname",NULL,NULL);
62906290

6291-
appendPQExpBufferStr(&buf,"ORDER BY 1, 2, o.amopstrategy, 3;");
6291+
appendPQExpBufferStr(&buf,"ORDER BY 1, 2,\n"
6292+
" o.amoplefttype = o.amoprighttype DESC,\n"
6293+
" pg_catalog.format_type(o.amoplefttype, NULL),\n"
6294+
" pg_catalog.format_type(o.amoprighttype, NULL),\n"
6295+
" o.amopstrategy;");
62926296

62936297
res=PSQLexec(buf.data);
62946298
termPQExpBuffer(&buf);
@@ -6327,7 +6331,7 @@ listOpFamilyProcedures(const char *access_method_pattern,
63276331
initPQExpBuffer(&buf);
63286332

63296333
printfPQExpBuffer(&buf,
6330-
"SELECT DISTINCT\n"
6334+
"SELECT\n"
63316335
" am.amname AS \"%s\",\n"
63326336
" CASE\n"
63336337
" WHEN pg_catalog.pg_opfamily_is_visible(of.oid)\n"
@@ -6360,8 +6364,9 @@ listOpFamilyProcedures(const char *access_method_pattern,
63606364
processSQLNamePattern(pset.db,&buf,family_pattern,have_where, false,
63616365
"ns.nspname","of.opfname",NULL,NULL);
63626366

6363-
appendPQExpBufferStr(&buf,
6364-
"ORDER BY 1, 2, 3, 4, 5;");
6367+
appendPQExpBufferStr(&buf,"ORDER BY 1, 2,\n"
6368+
" ap.amproclefttype = ap.amprocrighttype DESC,\n"
6369+
" 3, 4, 5;");
63656370

63666371
res=PSQLexec(buf.data);
63676372
termPQExpBuffer(&buf);

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

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4952,16 +4952,31 @@ List of access methods
49524952
btree | integer_ops | smallint, integer, bigint
49534953
(1 row)
49544954

4955-
\dAo brin uuid_minmax_ops
4956-
List of operators of operator families
4957-
AM | Opfamily Name | Operator
4958-
------+-----------------+-----------------
4959-
brin | uuid_minmax_ops | < (uuid, uuid)
4960-
brin | uuid_minmax_ops | <= (uuid, uuid)
4961-
brin | uuid_minmax_ops | = (uuid, uuid)
4962-
brin | uuid_minmax_ops | >= (uuid, uuid)
4963-
brin | uuid_minmax_ops | > (uuid, uuid)
4964-
(5 rows)
4955+
\dAo+ btree float_ops
4956+
List of operators of operator families
4957+
AM | Opfamily Name | Operator | Strategy | Purpose | Sort opfamily
4958+
-------+---------------+-----------------------------------------+----------+---------+---------------
4959+
btree | float_ops | < (double precision, double precision) | 1 | search |
4960+
btree | float_ops | <= (double precision, double precision) | 2 | search |
4961+
btree | float_ops | = (double precision, double precision) | 3 | search |
4962+
btree | float_ops | >= (double precision, double precision) | 4 | search |
4963+
btree | float_ops | > (double precision, double precision) | 5 | search |
4964+
btree | float_ops | < (real, real) | 1 | search |
4965+
btree | float_ops | <= (real, real) | 2 | search |
4966+
btree | float_ops | = (real, real) | 3 | search |
4967+
btree | float_ops | >= (real, real) | 4 | search |
4968+
btree | float_ops | > (real, real) | 5 | search |
4969+
btree | float_ops | < (double precision, real) | 1 | search |
4970+
btree | float_ops | <= (double precision, real) | 2 | search |
4971+
btree | float_ops | = (double precision, real) | 3 | search |
4972+
btree | float_ops | >= (double precision, real) | 4 | search |
4973+
btree | float_ops | > (double precision, real) | 5 | search |
4974+
btree | float_ops | < (real, double precision) | 1 | search |
4975+
btree | float_ops | <= (real, double precision) | 2 | search |
4976+
btree | float_ops | = (real, double precision) | 3 | search |
4977+
btree | float_ops | >= (real, double precision) | 4 | search |
4978+
btree | float_ops | > (real, double precision) | 5 | search |
4979+
(20 rows)
49654980

49664981
\dAo * pg_catalog.jsonb_path_ops
49674982
List of operators of operator families
@@ -4972,15 +4987,19 @@ List of access methods
49724987
gin | jsonb_path_ops | @@ (jsonb, jsonpath)
49734988
(3 rows)
49744989

4975-
\dAp brin uuid_minmax_ops
4976-
List of procedures of operator families
4977-
AM | Operator family | Left arg type | Right arg type | Number | Proc name
4978-
------+-----------------+---------------+----------------+--------+------------------------
4979-
brin | uuid_minmax_ops | uuid | uuid | 1 | brin_minmax_opcinfo
4980-
brin | uuid_minmax_ops | uuid | uuid | 2 | brin_minmax_add_value
4981-
brin | uuid_minmax_ops | uuid | uuid | 3 | brin_minmax_consistent
4982-
brin | uuid_minmax_ops | uuid | uuid | 4 | brin_minmax_union
4983-
(4 rows)
4990+
\dAp btree float_ops
4991+
List of procedures of operator families
4992+
AM | Operator family | Left arg type | Right arg type | Number | Proc name
4993+
-------+-----------------+------------------+------------------+--------+---------------------
4994+
btree | float_ops | double precision | double precision | 1 | btfloat8cmp
4995+
btree | float_ops | double precision | double precision | 2 | btfloat8sortsupport
4996+
btree | float_ops | double precision | double precision | 3 | in_range
4997+
btree | float_ops | real | real | 1 | btfloat4cmp
4998+
btree | float_ops | real | real | 2 | btfloat4sortsupport
4999+
btree | float_ops | double precision | real | 1 | btfloat84cmp
5000+
btree | float_ops | real | double precision | 1 | btfloat48cmp
5001+
btree | float_ops | real | double precision | 3 | in_range
5002+
(8 rows)
49845003

49855004
\dAp * pg_catalog.uuid_ops
49865005
List of procedures of operator families

‎src/test/regress/sql/psql.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ drop role regress_partitioning_role;
12031203
\dAc brin pg*.oid*
12041204
\dAf spgist
12051205
\dAf btree int4
1206-
\dAo brin uuid_minmax_ops
1206+
\dAo+ btree float_ops
12071207
\dAo*pg_catalog.jsonb_path_ops
1208-
\dApbrin uuid_minmax_ops
1208+
\dApbtree float_ops
12091209
\dAp*pg_catalog.uuid_ops

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp