summaryrefslogtreecommitdiff
path: root/src/bin/psql/describe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/describe.c')
-rw-r--r--src/bin/psql/describe.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 0e0af5f942c..8b4cd53631c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2115,8 +2115,8 @@ describeOneTableDetails(const char *schemaname,
" pg_catalog.pg_get_expr(c.relpartbound, inhrelid)");
/* If verbose, also request the partition constraint definition */
if (verbose)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.pg_get_partition_constraintdef(inhrelid)");
+ appendPQExpBufferStr(&buf,
+ ",\n pg_catalog.pg_get_partition_constraintdef(inhrelid)");
appendPQExpBuffer(&buf,
"\nFROM pg_catalog.pg_class c"
" JOIN pg_catalog.pg_inherits i"
@@ -2203,9 +2203,9 @@ describeOneTableDetails(const char *schemaname,
" false AS condeferrable, false AS condeferred,\n");
if (pset.sversion >= 90400)
- appendPQExpBuffer(&buf, "i.indisreplident,\n");
+ appendPQExpBufferStr(&buf, "i.indisreplident,\n");
else
- appendPQExpBuffer(&buf, "false AS indisreplident,\n");
+ appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
appendPQExpBuffer(&buf, " a.amname, c2.relname, "
"pg_catalog.pg_get_expr(i.indpred, i.indrelid, true)\n"
@@ -2263,7 +2263,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&tmpbuf, _(", initially deferred"));
if (strcmp(indisreplident, "t") == 0)
- appendPQExpBuffer(&tmpbuf, _(", replica identity"));
+ appendPQExpBufferStr(&tmpbuf, _(", replica identity"));
printTableAddFooter(&cont, tmpbuf.data);
add_tablespace_footer(&cont, tableinfo.relkind,
@@ -2374,7 +2374,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, " INVALID");
if (strcmp(PQgetvalue(result, i, 10), "t") == 0)
- appendPQExpBuffer(&buf, " REPLICA IDENTITY");
+ appendPQExpBufferStr(&buf, " REPLICA IDENTITY");
printTableAddFooter(&cont, buf.data);
@@ -2457,8 +2457,8 @@ describeOneTableDetails(const char *schemaname,
oid);
if (pset.sversion >= 120000)
- appendPQExpBuffer(&buf, " AND conparentid = 0\n");
- appendPQExpBuffer(&buf, "ORDER BY conname");
+ appendPQExpBufferStr(&buf, " AND conparentid = 0\n");
+ appendPQExpBufferStr(&buf, "ORDER BY conname");
}
result = PSQLexec(buf.data);
@@ -2556,11 +2556,11 @@ describeOneTableDetails(const char *schemaname,
{
printfPQExpBuffer(&buf, "SELECT pol.polname,");
if (pset.sversion >= 100000)
- appendPQExpBuffer(&buf,
- " pol.polpermissive,\n");
+ appendPQExpBufferStr(&buf,
+ " pol.polpermissive,\n");
else
- appendPQExpBuffer(&buf,
- " 't' as polpermissive,\n");
+ appendPQExpBufferStr(&buf,
+ " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2608,7 +2608,7 @@ describeOneTableDetails(const char *schemaname,
PQgetvalue(result, i, 0));
if (*(PQgetvalue(result, i, 1)) == 'f')
- appendPQExpBuffer(&buf, " AS RESTRICTIVE");
+ appendPQExpBufferStr(&buf, " AS RESTRICTIVE");
if (!PQgetisnull(result, i, 5))
appendPQExpBuffer(&buf, " FOR %s",
@@ -2913,12 +2913,12 @@ describeOneTableDetails(const char *schemaname,
"t.tgconstraint <> 0 AS tgisinternal" :
"false AS tgisinternal"), oid);
if (pset.sversion >= 110000)
- appendPQExpBuffer(&buf, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D') \n"
- " OR EXISTS (SELECT 1 FROM pg_catalog.pg_depend WHERE objid = t.oid \n"
- " AND refclassid = 'pg_catalog.pg_trigger'::pg_catalog.regclass))");
+ appendPQExpBufferStr(&buf, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D') \n"
+ " OR EXISTS (SELECT 1 FROM pg_catalog.pg_depend WHERE objid = t.oid \n"
+ " AND refclassid = 'pg_catalog.pg_trigger'::pg_catalog.regclass))");
else if (pset.sversion >= 90000)
/* display/warn about disabled internal triggers */
- appendPQExpBuffer(&buf, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D'))");
+ appendPQExpBufferStr(&buf, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D'))");
else if (pset.sversion >= 80300)
appendPQExpBufferStr(&buf, "(t.tgconstraint = 0 OR (t.tgconstraint <> 0 AND t.tgenabled = 'D'))");
else
@@ -3935,33 +3935,33 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
{
if (pset.sversion < 120000)
{
- appendPQExpBuffer(&buf,
- ",\n LATERAL (WITH RECURSIVE d\n"
- " AS (SELECT inhrelid AS oid, 1 AS level\n"
- " FROM pg_catalog.pg_inherits\n"
- " WHERE inhparent = c.oid\n"
- " UNION ALL\n"
- " SELECT inhrelid, level + 1\n"
- " FROM pg_catalog.pg_inherits i\n"
- " JOIN d ON i.inhparent = d.oid)\n"
- " SELECT pg_catalog.pg_size_pretty(sum(pg_catalog.pg_table_size("
- "d.oid))) AS tps,\n"
- " pg_catalog.pg_size_pretty(sum("
- "\n CASE WHEN d.level = 1"
- " THEN pg_catalog.pg_table_size(d.oid) ELSE 0 END)) AS dps\n"
- " FROM d) s");
+ appendPQExpBufferStr(&buf,
+ ",\n LATERAL (WITH RECURSIVE d\n"
+ " AS (SELECT inhrelid AS oid, 1 AS level\n"
+ " FROM pg_catalog.pg_inherits\n"
+ " WHERE inhparent = c.oid\n"
+ " UNION ALL\n"
+ " SELECT inhrelid, level + 1\n"
+ " FROM pg_catalog.pg_inherits i\n"
+ " JOIN d ON i.inhparent = d.oid)\n"
+ " SELECT pg_catalog.pg_size_pretty(sum(pg_catalog.pg_table_size("
+ "d.oid))) AS tps,\n"
+ " pg_catalog.pg_size_pretty(sum("
+ "\n CASE WHEN d.level = 1"
+ " THEN pg_catalog.pg_table_size(d.oid) ELSE 0 END)) AS dps\n"
+ " FROM d) s");
}
else
{
/* PostgreSQL 12 has pg_partition_tree function */
- appendPQExpBuffer(&buf,
- ",\n LATERAL (SELECT pg_catalog.pg_size_pretty(sum("
- "\n CASE WHEN ppt.isleaf AND ppt.level = 1"
- "\n THEN pg_catalog.pg_table_size(ppt.relid)"
- " ELSE 0 END)) AS dps"
- ",\n pg_catalog.pg_size_pretty(sum("
- "pg_catalog.pg_table_size(ppt.relid))) AS tps"
- "\n FROM pg_catalog.pg_partition_tree(c.oid) ppt) s");
+ appendPQExpBufferStr(&buf,
+ ",\n LATERAL (SELECT pg_catalog.pg_size_pretty(sum("
+ "\n CASE WHEN ppt.isleaf AND ppt.level = 1"
+ "\n THEN pg_catalog.pg_table_size(ppt.relid)"
+ " ELSE 0 END)) AS dps"
+ ",\n pg_catalog.pg_size_pretty(sum("
+ "pg_catalog.pg_table_size(ppt.relid))) AS tps"
+ "\n FROM pg_catalog.pg_partition_tree(c.oid) ppt) s");
}
}
@@ -4003,7 +4003,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
return false;
initPQExpBuffer(&title);
- appendPQExpBuffer(&title, "%s", tabletitle);
+ appendPQExpBufferStr(&title, tabletitle);
myopt.nullPrint = NULL;
myopt.title = title.data;
@@ -4567,8 +4567,8 @@ listSchemas(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Description"));
}
- appendPQExpBuffer(&buf,
- "\nFROM pg_catalog.pg_namespace n\n");
+ appendPQExpBufferStr(&buf,
+ "\nFROM pg_catalog.pg_namespace n\n");
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf,
@@ -5768,10 +5768,10 @@ describePublications(const char *pattern)
" pg_catalog.pg_get_userbyid(pubowner) AS owner,\n"
" puballtables, pubinsert, pubupdate, pubdelete");
if (has_pubtruncate)
- appendPQExpBuffer(&buf,
- ", pubtruncate");
- appendPQExpBuffer(&buf,
- "\nFROM pg_catalog.pg_publication\n");
+ appendPQExpBufferStr(&buf,
+ ", pubtruncate");
+ appendPQExpBufferStr(&buf,
+ "\nFROM pg_catalog.pg_publication\n");
processSQLNamePattern(pset.db, &buf, pattern, false, false,
NULL, "pubname", NULL,