@@ -54,7 +54,8 @@ static bool listOneExtensionContents(const char *extname, const char *oid);
5454 */
5555
5656
57- /* \da
57+ /*
58+ * \da
5859 * Takes an optional regexp to select particular aggregates
5960 */
6061bool
@@ -131,7 +132,8 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
131132 return true;
132133}
133134
134- /* \dA
135+ /*
136+ * \dA
135137 * Takes an optional regexp to select particular access methods
136138 */
137139bool
@@ -198,7 +200,8 @@ describeAccessMethods(const char *pattern, bool verbose)
198200 return true;
199201}
200202
201- /* \db
203+ /*
204+ * \db
202205 * Takes an optional regexp to select particular tablespaces
203206 */
204207bool
@@ -283,7 +286,8 @@ describeTablespaces(const char *pattern, bool verbose)
283286}
284287
285288
286- /* \df
289+ /*
290+ * \df
287291 * Takes an optional regexp to select particular functions.
288292 *
289293 * As with \d, you can specify the kinds of functions you want:
@@ -696,7 +700,8 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
696700}
697701
698702
699- /* \do
703+ /*
704+ * \do
700705 * Describe operators
701706 */
702707bool
@@ -2997,7 +3002,10 @@ add_tablespace_footer(printTableContent *const cont, char relkind,
29973002 "WHERE oid = '%u';" , tablespace );
29983003 result = PSQLexec (buf .data );
29993004 if (!result )
3005+ {
3006+ termPQExpBuffer (& buf );
30003007 return ;
3008+ }
30013009 /* Should always be the case, but.... */
30023010 if (PQntuples (result ) > 0 )
30033011 {
@@ -3209,35 +3217,36 @@ listDbRoleSettings(const char *pattern, const char *pattern2)
32093217 PQExpBufferData buf ;
32103218 PGresult * res ;
32113219 printQueryOpt myopt = pset .popt ;
3220+ bool havewhere ;
32123221
3213- initPQExpBuffer (& buf );
3214-
3215- if (pset .sversion >= 90000 )
3216- {
3217- bool havewhere ;
3218-
3219- printfPQExpBuffer (& buf , "SELECT rolname AS \"%s\", datname AS \"%s\",\n"
3220- "pg_catalog.array_to_string(setconfig, E'\\n') AS \"%s\"\n"
3221- "FROM pg_catalog.pg_db_role_setting s\n"
3222- "LEFT JOIN pg_catalog.pg_database d ON d.oid = setdatabase\n"
3223- "LEFT JOIN pg_catalog.pg_roles r ON r.oid = setrole\n" ,
3224- gettext_noop ("Role" ),
3225- gettext_noop ("Database" ),
3226- gettext_noop ("Settings" ));
3227- havewhere = processSQLNamePattern (pset .db , & buf , pattern , false, false,
3228- NULL , "r.rolname" , NULL , NULL );
3229- processSQLNamePattern (pset .db , & buf , pattern2 , havewhere , false,
3230- NULL , "d.datname" , NULL , NULL );
3231- appendPQExpBufferStr (& buf , "ORDER BY 1, 2;" );
3232- }
3233- else
3222+ if (pset .sversion < 90000 )
32343223 {
3235- fprintf (pset .queryFout ,
3236- _ ("No per-database role settings support in this server version.\n" ));
3237- return false;
3224+ char sverbuf [32 ];
3225+
3226+ psql_error ("The server (version %s) does not support per-database role settings.\n" ,
3227+ formatPGVersionNumber (pset .sversion , false,
3228+ sverbuf , sizeof (sverbuf )));
3229+ return true;
32383230 }
32393231
3232+ initPQExpBuffer (& buf );
3233+
3234+ printfPQExpBuffer (& buf , "SELECT rolname AS \"%s\", datname AS \"%s\",\n"
3235+ "pg_catalog.array_to_string(setconfig, E'\\n') AS \"%s\"\n"
3236+ "FROM pg_catalog.pg_db_role_setting s\n"
3237+ "LEFT JOIN pg_catalog.pg_database d ON d.oid = setdatabase\n"
3238+ "LEFT JOIN pg_catalog.pg_roles r ON r.oid = setrole\n" ,
3239+ gettext_noop ("Role" ),
3240+ gettext_noop ("Database" ),
3241+ gettext_noop ("Settings" ));
3242+ havewhere = processSQLNamePattern (pset .db , & buf , pattern , false, false,
3243+ NULL , "r.rolname" , NULL , NULL );
3244+ processSQLNamePattern (pset .db , & buf , pattern2 , havewhere , false,
3245+ NULL , "d.datname" , NULL , NULL );
3246+ appendPQExpBufferStr (& buf , "ORDER BY 1, 2;" );
3247+
32403248 res = PSQLexec (buf .data );
3249+ termPQExpBuffer (& buf );
32413250 if (!res )
32423251 return false;
32433252
@@ -3258,7 +3267,6 @@ listDbRoleSettings(const char *pattern, const char *pattern2)
32583267 }
32593268
32603269 PQclear (res );
3261- resetPQExpBuffer (& buf );
32623270 return true;
32633271}
32643272
@@ -5024,7 +5032,8 @@ listOneExtensionContents(const char *extname, const char *oid)
50245032 return true;
50255033}
50265034
5027- /* \dRp
5035+ /*
5036+ * \dRp
50285037 * Lists publications.
50295038 *
50305039 * Takes an optional regexp to select particular publications
@@ -5090,7 +5099,8 @@ listPublications(const char *pattern)
50905099 return true;
50915100}
50925101
5093- /* \dRp+
5102+ /*
5103+ * \dRp+
50945104 * Describes publications including the contents.
50955105 *
50965106 * Takes an optional regexp to select particular publications
@@ -5211,7 +5221,8 @@ describePublications(const char *pattern)
52115221 return true;
52125222}
52135223
5214- /* \dRs
5224+ /*
5225+ * \dRs
52155226 * Describes subscriptions.
52165227 *
52175228 * Takes an optional regexp to select particular subscriptions
0 commit comments