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

Commit9dea962

Browse files
committed
Include publication owner's name in the output of \dRp+.
Without this, \dRp prints information that \dRp+ does not, whichseems pretty odd.Daniel GustafssonDiscussion:https://postgr.es/m/3641F19B-336A-431A-86CE-A80562505C5E@yesql.se
1 parent3c163a7 commit9dea962

File tree

2 files changed

+31
-28
lines changed

2 files changed

+31
-28
lines changed

‎src/bin/psql/describe.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5162,8 +5162,9 @@ describePublications(const char *pattern)
51625162
initPQExpBuffer(&buf);
51635163

51645164
printfPQExpBuffer(&buf,
5165-
"SELECT oid, pubname, puballtables, pubinsert,\n"
5166-
" pubupdate, pubdelete\n"
5165+
"SELECT oid, pubname,\n"
5166+
" pg_catalog.pg_get_userbyid(pubowner) AS owner,\n"
5167+
" puballtables, pubinsert, pubupdate, pubdelete\n"
51675168
"FROM pg_catalog.pg_publication\n");
51685169

51695170
processSQLNamePattern(pset.db,&buf,pattern, false, false,
@@ -5198,13 +5199,13 @@ describePublications(const char *pattern)
51985199
for (i=0;i<PQntuples(res);i++)
51995200
{
52005201
constcharalign='l';
5201-
intncols=4;
5202+
intncols=5;
52025203
intnrows=1;
52035204
inttables=0;
52045205
PGresult*tabres;
52055206
char*pubid=PQgetvalue(res,i,0);
52065207
char*pubname=PQgetvalue(res,i,1);
5207-
boolpuballtables=strcmp(PQgetvalue(res,i,2),"t")==0;
5208+
boolpuballtables=strcmp(PQgetvalue(res,i,3),"t")==0;
52085209
intj;
52095210
PQExpBufferDatatitle;
52105211
printTableOptmyopt=pset.popt.topt;
@@ -5214,6 +5215,7 @@ describePublications(const char *pattern)
52145215
printfPQExpBuffer(&title,_("Publication %s"),pubname);
52155216
printTableInit(&cont,&myopt,title.data,ncols,nrows);
52165217

5218+
printTableAddHeader(&cont,gettext_noop("Owner"), true,align);
52175219
printTableAddHeader(&cont,gettext_noop("All tables"), true,align);
52185220
printTableAddHeader(&cont,gettext_noop("Inserts"), true,align);
52195221
printTableAddHeader(&cont,gettext_noop("Updates"), true,align);
@@ -5223,6 +5225,7 @@ describePublications(const char *pattern)
52235225
printTableAddCell(&cont,PQgetvalue(res,i,3), false, false);
52245226
printTableAddCell(&cont,PQgetvalue(res,i,4), false, false);
52255227
printTableAddCell(&cont,PQgetvalue(res,i,5), false, false);
5228+
printTableAddCell(&cont,PQgetvalue(res,i,6), false, false);
52265229

52275230
if (!puballtables)
52285231
{

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

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ Publications:
7676
"testpub_foralltables"
7777

7878
\dRp+ testpub_foralltables
79-
Publication testpub_foralltables
80-
All tables | Inserts | Updates | Deletes
81-
------------+---------+---------+---------
82-
t | t | t | f
79+
Publication testpub_foralltables
80+
Owner |All tables | Inserts | Updates | Deletes
81+
--------------------------+------------+---------+---------+---------
82+
regress_publication_user |t | t | t | f
8383
(1 row)
8484

8585
DROP TABLE testpub_tbl2;
@@ -89,19 +89,19 @@ CREATE TABLE testpub_tbl3a (b text) INHERITS (testpub_tbl3);
8989
CREATE PUBLICATION testpub3 FOR TABLE testpub_tbl3;
9090
CREATE PUBLICATION testpub4 FOR TABLE ONLY testpub_tbl3;
9191
\dRp+ testpub3
92-
Publication testpub3
93-
All tables | Inserts | Updates | Deletes
94-
------------+---------+---------+---------
95-
f | t | t | t
92+
Publication testpub3
93+
Owner |All tables | Inserts | Updates | Deletes
94+
--------------------------+------------+---------+---------+---------
95+
regress_publication_user |f | t | t | t
9696
Tables:
9797
"public.testpub_tbl3"
9898
"public.testpub_tbl3a"
9999

100100
\dRp+ testpub4
101-
Publication testpub4
102-
All tables | Inserts | Updates | Deletes
103-
------------+---------+---------+---------
104-
f | t | t | t
101+
Publication testpub4
102+
Owner |All tables | Inserts | Updates | Deletes
103+
--------------------------+------------+---------+---------+---------
104+
regress_publication_user |f | t | t | t
105105
Tables:
106106
"public.testpub_tbl3"
107107

@@ -119,10 +119,10 @@ ERROR: relation "testpub_tbl1" is already member of publication "testpub_fortbl
119119
CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_tbl1;
120120
ERROR: publication "testpub_fortbl" already exists
121121
\dRp+ testpub_fortbl
122-
Publication testpub_fortbl
123-
All tables | Inserts | Updates | Deletes
124-
------------+---------+---------+---------
125-
f | t | t | t
122+
Publication testpub_fortbl
123+
Owner |All tables | Inserts | Updates | Deletes
124+
--------------------------+------------+---------+---------+---------
125+
regress_publication_user |f | t | t | t
126126
Tables:
127127
"pub_test.testpub_nopk"
128128
"public.testpub_tbl1"
@@ -165,10 +165,10 @@ Publications:
165165
"testpub_fortbl"
166166

167167
\dRp+ testpub_default
168-
Publication testpub_default
169-
All tables | Inserts | Updates | Deletes
170-
------------+---------+---------+---------
171-
f | t | t | t
168+
Publication testpub_default
169+
Owner |All tables | Inserts | Updates | Deletes
170+
--------------------------+------------+---------+---------+---------
171+
regress_publication_user |f | t | t | t
172172
Tables:
173173
"pub_test.testpub_nopk"
174174
"public.testpub_tbl1"
@@ -210,10 +210,10 @@ DROP TABLE testpub_parted;
210210
DROP VIEW testpub_view;
211211
DROP TABLE testpub_tbl1;
212212
\dRp+ testpub_default
213-
Publication testpub_default
214-
All tables | Inserts | Updates | Deletes
215-
------------+---------+---------+---------
216-
f | t | t | t
213+
Publication testpub_default
214+
Owner |All tables | Inserts | Updates | Deletes
215+
--------------------------+------------+---------+---------+---------
216+
regress_publication_user |f | t | t | t
217217
(1 row)
218218

219219
-- fail - must be owner of publication

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp