@@ -54,7 +54,8 @@ static bool listOneExtensionContents(const char *extname, const char *oid);
54
54
*/
55
55
56
56
57
- /* \da
57
+ /*
58
+ * \da
58
59
* Takes an optional regexp to select particular aggregates
59
60
*/
60
61
bool
@@ -131,7 +132,8 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
131
132
return true;
132
133
}
133
134
134
- /* \dA
135
+ /*
136
+ * \dA
135
137
* Takes an optional regexp to select particular access methods
136
138
*/
137
139
bool
@@ -198,7 +200,8 @@ describeAccessMethods(const char *pattern, bool verbose)
198
200
return true;
199
201
}
200
202
201
- /* \db
203
+ /*
204
+ * \db
202
205
* Takes an optional regexp to select particular tablespaces
203
206
*/
204
207
bool
@@ -283,7 +286,8 @@ describeTablespaces(const char *pattern, bool verbose)
283
286
}
284
287
285
288
286
- /* \df
289
+ /*
290
+ * \df
287
291
* Takes an optional regexp to select particular functions.
288
292
*
289
293
* As with \d, you can specify the kinds of functions you want:
@@ -696,7 +700,8 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
696
700
}
697
701
698
702
699
- /* \do
703
+ /*
704
+ * \do
700
705
* Describe operators
701
706
*/
702
707
bool
@@ -2997,7 +3002,10 @@ add_tablespace_footer(printTableContent *const cont, char relkind,
2997
3002
"WHERE oid = '%u';" , tablespace );
2998
3003
result = PSQLexec (buf .data );
2999
3004
if (!result )
3005
+ {
3006
+ termPQExpBuffer (& buf );
3000
3007
return ;
3008
+ }
3001
3009
/* Should always be the case, but.... */
3002
3010
if (PQntuples (result ) > 0 )
3003
3011
{
@@ -3209,35 +3217,36 @@ listDbRoleSettings(const char *pattern, const char *pattern2)
3209
3217
PQExpBufferData buf ;
3210
3218
PGresult * res ;
3211
3219
printQueryOpt myopt = pset .popt ;
3220
+ bool havewhere ;
3212
3221
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 )
3234
3223
{
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;
3238
3230
}
3239
3231
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
+
3240
3248
res = PSQLexec (buf .data );
3249
+ termPQExpBuffer (& buf );
3241
3250
if (!res )
3242
3251
return false;
3243
3252
@@ -3258,7 +3267,6 @@ listDbRoleSettings(const char *pattern, const char *pattern2)
3258
3267
}
3259
3268
3260
3269
PQclear (res );
3261
- resetPQExpBuffer (& buf );
3262
3270
return true;
3263
3271
}
3264
3272
@@ -5024,7 +5032,8 @@ listOneExtensionContents(const char *extname, const char *oid)
5024
5032
return true;
5025
5033
}
5026
5034
5027
- /* \dRp
5035
+ /*
5036
+ * \dRp
5028
5037
* Lists publications.
5029
5038
*
5030
5039
* Takes an optional regexp to select particular publications
@@ -5090,7 +5099,8 @@ listPublications(const char *pattern)
5090
5099
return true;
5091
5100
}
5092
5101
5093
- /* \dRp+
5102
+ /*
5103
+ * \dRp+
5094
5104
* Describes publications including the contents.
5095
5105
*
5096
5106
* Takes an optional regexp to select particular publications
@@ -5211,7 +5221,8 @@ describePublications(const char *pattern)
5211
5221
return true;
5212
5222
}
5213
5223
5214
- /* \dRs
5224
+ /*
5225
+ * \dRs
5215
5226
* Describes subscriptions.
5216
5227
*
5217
5228
* Takes an optional regexp to select particular subscriptions
0 commit comments