summaryrefslogtreecommitdiff
path: root/src/bin/psql/describe.c
diff options
context:
space:
mode:
authorTom Lane2021-05-27 17:24:24 +0000
committerTom Lane2021-05-27 17:24:27 +0000
commite6241d8e030fbd2746b3ea3f44e728224298f35b (patch)
treee4bfc50561023459635cb9faf0873fee1e891013 /src/bin/psql/describe.c
parenta717e5c771610cf8607f2423ab3ab6b5d30f44ea (diff)
Rethink definition of pg_attribute.attcompression.
Redefine '\0' (InvalidCompressionMethod) as meaning "if we need to compress, use the current setting of default_toast_compression". This allows '\0' to be a suitable default choice regardless of datatype, greatly simplifying code paths that initialize tupledescs and the like. It seems like a more user-friendly approach as well, because now the default compression choice doesn't migrate into table definitions, meaning that changing default_toast_compression is usually sufficient to flip an installation's behavior; one needn't tediously issue per-column ALTER SET COMPRESSION commands. Along the way, fix a few minor bugs and documentation issues with the per-column-compression feature. Adopt more robust APIs for SetIndexStorageProperties and GetAttributeCompression. Bump catversion because typical contents of attcompression will now be different. We could get away without doing that, but it seems better to ensure v14 installations all agree on this. (We already forced initdb for beta2, anyway.) Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/bin/psql/describe.c')
-rw-r--r--src/bin/psql/describe.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 3e39fdb5452..195f8d8cd2d 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -1636,9 +1636,9 @@ describeOneTableDetails(const char *schemaname,
indexdef_col = -1,
fdwopts_col = -1,
attstorage_col = -1,
+ attcompression_col = -1,
attstattarget_col = -1,
- attdescr_col = -1,
- attcompression_col = -1;
+ attdescr_col = -1;
int numrows;
struct
{
@@ -2055,7 +2055,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n a.attstorage");
attstorage_col = cols++;
- /* compression info */
+ /* compression info, if relevant to relkind */
if (pset.sversion >= 140000 &&
!pset.hide_compression &&
(tableinfo.relkind == RELKIND_RELATION ||
@@ -2259,7 +2259,7 @@ describeOneTableDetails(const char *schemaname,
if (fdwopts_col >= 0)
printTableAddCell(&cont, PQgetvalue(res, i, fdwopts_col), false, false);
- /* Storage and Description */
+ /* Storage mode, if relevant */
if (attstorage_col >= 0)
{
char *storage = PQgetvalue(res, i, attstorage_col);
@@ -2273,7 +2273,7 @@ describeOneTableDetails(const char *schemaname,
false, false);
}
- /* Column compression. */
+ /* Column compression, if relevant */
if (attcompression_col >= 0)
{
char *compression = PQgetvalue(res, i, attcompression_col);