Re: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET, RESET}

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
Subject: Re: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET, RESET}
Date: 2021-10-29 18:23:34
Message-ID: 892A6F07-DD04-4722-ADE3-DAB2F9C1212C@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/29/21, 2:14 AM, "Michael Paquier" <michael(at)paquier(dot)xyz> wrote:
> By the way, while looking at this area of the code (particularly
> tsvector and gist), I was under the impression that it is safe to
> assume that we don't particularly need to rebuild the index when
> changing its attoptions this way, but I have also the feeling to be
> rather naive here.

This is my concern as well. I remember seeing some weird errors in
the thread that led to fdd8857, and I was able to reproduce it with
this new patch. If you apply the following patch for the hstore test,
it will begin failing.

--

diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out
index 64a3272b9c..a4c78a40c8 100644
--- a/contrib/hstore/expected/hstore.out
+++ b/contrib/hstore/expected/hstore.out
@@ -1352,6 +1352,7 @@ create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2025));
ERROR: value 2025 out of bounds for option "siglen"
DETAIL: Valid values are between "1" and "2024".
create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2024));
+alter index hidx alter column 1 set (siglen=100);
set enable_seqscan=off;
select count(*) from testhstore where h @> 'wait=>NULL';
count
diff --git a/contrib/hstore/sql/hstore.sql b/contrib/hstore/sql/hstore.sql
index a59db66b0a..5e2a1ec99f 100644
--- a/contrib/hstore/sql/hstore.sql
+++ b/contrib/hstore/sql/hstore.sql
@@ -308,6 +308,7 @@ drop index hidx;
create index hidx on testhstore using gist(h gist_hstore_ops(siglen=0));
create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2025));
create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2024));
+alter index hidx alter column 1 set (siglen=100);
set enable_seqscan=off;

select count(*) from testhstore where h @> 'wait=>NULL';

--

However, if you add a REINDEX right after the ALTER INDEX command, it
will succeed.

Nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-10-29 18:44:38 Re: when the startup process doesn't (logging startup delays)
Previous Message Robert Haas 2021-10-29 18:09:53 Re: ThisTimeLineID is used uninitialized in basebackup.c, too