Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

The table is moved to tablespace pg _default from database default tablespace #363

Closed
vut12 opened this issue Jun 30, 2023 · 2 comments
Closed
Labels

Comments

@vut12
Copy link

vut12 commented Jun 30, 2023

pg_repack 1.4.8
this problem is observed if set new default tablespace to database.

# ALTER DATABASE postgres SET TABLESPACE tbs_new;
# SELECT d.datname, tbs.spcname FROM pg_database d 
    JOIN pg_tablespace tbs ON d.dattablespace=tbs.oid WHERE d.datname='postgres';
 datname  |  spcname
----------+------------
 postgres | tbs_new
(1 row)

# CREATE TABLE table_tbs_new (id int4 PRIMARY KEY);
# SELECT tablename, tablespace FROM pg_tables WHERE tablename='table_tbs_new';
   tablename   | tablespace
---------------+------------
 table_tbs_new |
(1 row)

Now table "table_tbs_new" in tablespace "tbs_new". Run pg_repack , assuming the tablespace doesn't change.

pg_repack -D -d postgres -t public.table_tbs_new

# SELECT tablename, tablespace FROM pg_tables WHERE tablename='table_tbs_new';
   tablename   | tablespace
---------------+------------
 table_tbs_new | pg_default
(1 row)

after pg_repack table moved from tbs_new to pg_default

@vut12 vut12 changed the title The table is moved to the pg _default tablespace from database default tablespace The table is moved to pg _default tablespace from database default tablespace Jun 30, 2023
@vut12 vut12 changed the title The table is moved to pg _default tablespace from database default tablespace The table is moved to tablespace pg _default from database default tablespace Jun 30, 2023
@za-arthur
Copy link
Collaborator

I guess this is because pg_default is hard coded in repack.tables view:

coalesce(quote_ident(S.spcname), 'pg_default') as tablespace_orig,

@za-arthur
Copy link
Collaborator

This was fixed within #368

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants