On 2018/10/30 20:03, Pavel Stehule wrote: > út 30. 10. 2018 v 7:52 odesílatel Amit Langote < > Langote_Amit_f8@lab.ntt.co.jp> napsal: >> Could one of you please revise the patch to use that function to produce >> the output of \dP+? >> > > here it is. > > It is based on Mathias's patch. Although we can use pg_partition_tree on > PostgreSQL, we still should to support PostgreSQL 10, 11 where this > function is not available
Thanks for updating the patch. Just a couple of comments:
+ is used, a sum of size of related partitions and a description
I suggest:
is used, the sum of sizes of related partitions and associated description
+ appendPQExpBufferStr(&buf, "\nWHERE c.relkind IN ('p')\n");
I wonder if we should list partitioned indexes ('I') as well, because their size information is not available with \di+. But maybe, they should have a separate command.
I though about it too and I prefer separate command. Similar to \di+
+ if (PQntuples(res) == 0 && !pset.quiet) + { + if (pattern) + psql_error("Did not find any relation named \"%s\".\n", + pattern); + else + psql_error("Did not find any relations.\n"); + }
I think we should use "partitioned table" instead of "relation" in the above error messages, because this command is specifically finding partitioned tables.
(If we decide to include partitioned indexes as well, then the above error message should say "partitioned relation")
+ fprintf(output, _(" \\dP[+] [PATTERN] list partitioned tables\n"));
Again, if we include indexes, this should be "partitioned relations".
How about adding a couple of regression tests?
I am not sure. Has not sense run this test over empty database, and some bigger database can increase running.