Обсуждение: pgsql: Fix tablespace handling for partitioned indexes
Fix tablespace handling for partitioned indexes When creating partitioned indexes, the tablespace was not being saved for the parent index. This meant that subsequently created partitions would not use the right tablespace for their indexes. ALTER INDEX SET TABLESPACE and ALTER INDEX ALL IN TABLESPACE raised errors when tried; fix them too. This requires bespoke code for ATExecCmd() that applies to the special case when the tablespace move is just a catalog change. Discussion: https://postgr.es/m/20181102003138.uxpaca6qfxzskepi@alvherre.pgsql Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/dfa6081419829ef60d6bc02691616337eeb7f988 Modified Files -------------- src/backend/catalog/heap.c | 10 +++++- src/backend/commands/tablecmds.c | 60 +++++++++++++++++++++++++++++-- src/test/regress/input/tablespace.source | 10 ++++++ src/test/regress/output/tablespace.source | 19 +++++++++- 4 files changed, 94 insertions(+), 5 deletions(-)
On Sun, 4 Nov 2018 at 05:33, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote: > Fix tablespace handling for partitioned indexes While working on something else, I noticed this: # create table listp (a int) partition by list(a); CREATE TABLE # create index on listp (a) tablespace pg_global; -- properly disallowed ERROR: only shared relations can be placed in pg_global tablespace # create index on listp (a); CREATE INDEX # alter index listp_a_idx set tablespace pg_global; -- should be disallowed ALTER INDEX # create table listp1 partition of listp for values in(1); ERROR: only shared relations can be placed in pg_global tablespace A patch to fix is attached. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
On 2018-Nov-23, David Rowley wrote: > A patch to fix is attached. Oops! Thanks. Pushed. I added a test line to verify that the error is thrown. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services