mirror of
https://github.com/postgres/postgres.git
synced 2025-11-03 09:13:20 +03:00
Allow specifying STORAGE attribute for a new table
Previously, the STORAGE specification was only available in ALTER TABLE. This makes it available in CREATE TABLE as well. Also make the code and the documentation for STORAGE and COMPRESSION attributes consistent. Author: Teodor Sigaev <teodor@sigaev.ru> Author: Aleksander Alekseev <aleksander@timescale.com> Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Reviewed-by: wenjing zeng <wjzeng2012@gmail.com> Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/de83407a-ae3d-a8e1-a788-920eb334f25b@sigaev.ru
This commit is contained in:
@@ -1527,7 +1527,7 @@ alter table recur1 add column f2 int;
|
||||
alter table recur1 alter column f2 type recur2; -- fails
|
||||
|
||||
-- SET STORAGE may need to add a TOAST table
|
||||
create table test_storage (a text);
|
||||
create table test_storage (a text, c text storage plain);
|
||||
alter table test_storage alter a set storage plain;
|
||||
alter table test_storage add b int default 0; -- rewrite table to remove its TOAST table
|
||||
alter table test_storage alter a set storage extended; -- re-add TOAST table
|
||||
@@ -1536,6 +1536,9 @@ select reltoastrelid <> 0 as has_toast_table
|
||||
from pg_class
|
||||
where oid = 'test_storage'::regclass;
|
||||
|
||||
-- check STORAGE correctness
|
||||
create table test_storage_failed (a text, b int storage extended);
|
||||
|
||||
-- test that SET STORAGE propagates to index correctly
|
||||
create index test_storage_idx on test_storage (b, a);
|
||||
alter table test_storage alter column a set storage external;
|
||||
|
||||
Reference in New Issue
Block a user