mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Don't allow partitioned indexes in pg_global tablespace
Missing in dfa6081419
.
Author: David Rowley
Discussion: https://postgr.es/m/CAKJS1f-M3NMTCpv=vDfkoqHbMPFf=3-Z1ud=+1DHH00tC+zLaQ@mail.gmail.com
This commit is contained in:
parent
a80dcac60c
commit
de38ce1b83
@ -10939,6 +10939,12 @@ ATExecPartedIdxSetTableSpace(Relation rel, Oid newTableSpace)
|
||||
|
||||
Assert(rel->rd_rel->relkind == RELKIND_PARTITIONED_INDEX);
|
||||
|
||||
/* Can't allow a non-shared relation in pg_global */
|
||||
if (newTableSpace == GLOBALTABLESPACE_OID)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("only shared relations can be placed in pg_global tablespace")));
|
||||
|
||||
/*
|
||||
* No work if no change in tablespace.
|
||||
*/
|
||||
|
@ -101,6 +101,7 @@ CREATE UNIQUE INDEX anindex ON testschema.atable(column1);
|
||||
|
||||
ALTER TABLE testschema.atable SET TABLESPACE regress_tblspace;
|
||||
ALTER INDEX testschema.anindex SET TABLESPACE regress_tblspace;
|
||||
ALTER INDEX testschema.part_a_idx SET TABLESPACE pg_global;
|
||||
ALTER INDEX testschema.part_a_idx SET TABLESPACE pg_default;
|
||||
ALTER INDEX testschema.part_a_idx SET TABLESPACE regress_tblspace;
|
||||
|
||||
|
@ -214,6 +214,8 @@ CREATE TABLE testschema.atable AS VALUES (1), (2);
|
||||
CREATE UNIQUE INDEX anindex ON testschema.atable(column1);
|
||||
ALTER TABLE testschema.atable SET TABLESPACE regress_tblspace;
|
||||
ALTER INDEX testschema.anindex SET TABLESPACE regress_tblspace;
|
||||
ALTER INDEX testschema.part_a_idx SET TABLESPACE pg_global;
|
||||
ERROR: only shared relations can be placed in pg_global tablespace
|
||||
ALTER INDEX testschema.part_a_idx SET TABLESPACE pg_default;
|
||||
ALTER INDEX testschema.part_a_idx SET TABLESPACE regress_tblspace;
|
||||
INSERT INTO testschema.atable VALUES(3); -- ok
|
||||
|
Loading…
Reference in New Issue
Block a user