Re: Preserve tablespace of exclusion constraint indexes in ALTER TYPE

From: Osama Abdul Qader <osamaabdulqaderpostgres(at)gmail(dot)com>
To: 신성준 <shinsj4653(at)gmail(dot)com>
Cc: pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Henson Choi <assam258(at)gmail(dot)com>
Subject: Re: Preserve tablespace of exclusion constraint indexes in ALTER TYPE
Date: 2026-11-26 19:28:58
Message-ID: CAAprpiCkqqTL3jykijgngYybJz+8=jA14BO8kguMF7Wx+ykgpQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi 신성준,

On Thu, 26 Nov, 2026, 6:47 pm 신성준, <shinsj4653(at)gmail(dot)com> wrote:

> Hi hackers,
>
> When ALTER TABLE ... ALTER COLUMN TYPE rebuilds an exclusion
> constraint, its index loses the tablespace given with USING INDEX
> TABLESPACE. If the index storage is reused because no rewrite is
> needed, the index can't be opened afterwards:
>
> SET allow_in_place_tablespaces = on;
> CREATE TABLESPACE ts LOCATION '';
> CREATE TABLE t (b varchar(5),
> EXCLUDE USING btree (b WITH =) USING INDEX TABLESPACE ts);
> INSERT INTO t VALUES ('y');
> ALTER TABLE t ALTER b TYPE varchar(10);
> INSERT INTO t VALUES ('w');
> ERROR: could not open file "base/5/16388": No such file or directory
>
> The constraint is rebuilt from pg_get_constraintdef_command(), which
> prints the tablespace for primary key and unique constraints but not
> for exclusion constraints. The attached patch prints it for those too
> when a full command is requested, so pg_get_constraintdef() and pg_dump
> are not affected.
>
> Best regards,
> Seongjun Shin
>

I'm interested in reviewing it. I hope for the best.

Best regards,
Osama Abdul Qader.

>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Fittl 2026-11-26 19:52:46 Re: Unify parallel worker handling for index builds and instrumentation
Previous Message Osama Abdul Qader 2026-11-26 19:20:08 Re: Fix deparsing of SUBSTRING SIMILAR with an operator as first argument