From b9424d014e195386a83b0f1fe9f5a8e5727e46ea Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 10 Nov 2022 18:20:49 -0500 Subject: Support writing "CREATE/ALTER TABLE ... SET STORAGE DEFAULT". We already allow explicitly writing DEFAULT for SET COMPRESSION, so it seems a bit inflexible and non-orthogonal to not have it for STORAGE. Aleksander Alekseev Discussion: https://postgr.es/m/CAJ7c6TMX9ui+6y3TQFaXJYVpZyBukvqhQbVDJ8OUokeLRhtnpA@mail.gmail.com --- doc/src/sgml/ref/alter_foreign_table.sgml | 2 +- doc/src/sgml/ref/alter_materialized_view.sgml | 2 +- doc/src/sgml/ref/alter_table.sgml | 22 +++++++++++++--------- doc/src/sgml/ref/create_table.sgml | 18 ++++++++++-------- 4 files changed, 25 insertions(+), 19 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/alter_foreign_table.sgml b/doc/src/sgml/ref/alter_foreign_table.sgml index 7ca03f3ac9f..d056dc1bb13 100644 --- a/doc/src/sgml/ref/alter_foreign_table.sgml +++ b/doc/src/sgml/ref/alter_foreign_table.sgml @@ -41,7 +41,7 @@ ALTER FOREIGN TABLE [ IF EXISTS ] namecolumn_name SET STATISTICS integer ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] ) ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] ) - ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } + ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } ALTER [ COLUMN ] column_name OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ADD table_constraint [ NOT VALID ] VALIDATE CONSTRAINT constraint_name diff --git a/doc/src/sgml/ref/alter_materialized_view.sgml b/doc/src/sgml/ref/alter_materialized_view.sgml index cae135c27a0..040ae53f982 100644 --- a/doc/src/sgml/ref/alter_materialized_view.sgml +++ b/doc/src/sgml/ref/alter_materialized_view.sgml @@ -39,7 +39,7 @@ ALTER MATERIALIZED VIEW ALL IN TABLESPACE namecolumn_name SET STATISTICS integer ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] ) ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] ) - ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } + ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } ALTER [ COLUMN ] column_name SET COMPRESSION compression_method CLUSTER ON index_name SET WITHOUT CLUSTER diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index f0f912a56c5..43d782fea90 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -53,7 +53,7 @@ ALTER TABLE [ IF EXISTS ] name ALTER [ COLUMN ] column_name SET STATISTICS integer ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] ) ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] ) - ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } + ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } ALTER [ COLUMN ] column_name SET COMPRESSION compression_method ADD table_constraint [ NOT VALID ] ADD table_constraint_using_index @@ -367,7 +367,7 @@ WITH ( MODULUS numeric_literal, REM - SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } + SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } TOAST per-column storage settings @@ -376,20 +376,24 @@ WITH ( MODULUS numeric_literal, REM This form sets the storage mode for a column. This controls whether this - column is held inline or in a secondary TOAST table, and - whether the data + column is held inline or in a secondary TOAST table, + and whether the data should be compressed or not. PLAIN must be used for fixed-length values such as integer and is inline, uncompressed. MAIN is for inline, compressible data. EXTERNAL is for external, uncompressed data, and EXTENDED is for external, - compressed data. EXTENDED is the default for most - data types that support non-PLAIN storage. + compressed data. + Writing DEFAULT sets the storage mode to the default + mode for the column's data type. EXTENDED is the + default for most data types that support non-PLAIN + storage. Use of EXTERNAL will make substring operations on very large text and bytea values run faster, - at the penalty of increased storage space. Note that - SET STORAGE doesn't itself change anything in the table, - it just sets the strategy to be pursued during future table updates. + at the penalty of increased storage space. + Note that ALTER TABLE ... SET STORAGE doesn't itself + change anything in the table; it just sets the strategy to be pursued + during future table updates. See for more information. diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index c14b2010d81..c98223b2a51 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -22,7 +22,7 @@ PostgreSQL documentation CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] table_name ( [ - { column_name data_type [ STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } ] [ COMPRESSION compression_method ] [ COLLATE collation ] [ column_constraint [ ... ] ] + { column_name data_type [ STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } ] [ COMPRESSION compression_method ] [ COLLATE collation ] [ column_constraint [ ... ] ] | table_constraint | LIKE source_table [ like_option ... ] } [, ... ] @@ -299,7 +299,7 @@ WITH ( MODULUS numeric_literal, REM - STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } + STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } TOAST per-column storage settings @@ -314,12 +314,14 @@ WITH ( MODULUS numeric_literal, REM inline, uncompressed. MAIN is for inline, compressible data. EXTERNAL is for external, uncompressed data, and EXTENDED is for external, compressed data. - EXTENDED is the default for most data types that - support non-PLAIN storage. Use of - EXTERNAL will make substring operations on very large - text and bytea values run faster, at the penalty - of increased storage space. See for more - information. + Writing DEFAULT sets the storage mode to the default + mode for the column's data type. EXTENDED is the + default for most data types that support non-PLAIN + storage. + Use of EXTERNAL will make substring operations on + very large text and bytea values run faster, + at the penalty of increased storage space. + See for more information. -- cgit v1.2.3