Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)

From: Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>
To: Shayon Mukherjee <shayonj(at)gmail(dot)com>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)
Date: 2025-01-24 15:26:23
Message-ID: CAPE8EZ5G+CZiw=p1Cs7DOZ2MGLa1yTS8Tk=Thzi1F14N2A=1oQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I also noticed that \d on an index doesn't warn about the invisible state
whereas \d on a table does:

[local]:5444 postgres(at)postgres=# SELECT indexrelid::regclass,
indisvalid, indisvisible FROM pg_index WHERE indexrelid =
'repli_pkey'::regclass \gx
-[ RECORD 1 ]+-----------
indexrelid | repli_pkey
indisvalid | f
indisvisible | f

[local]:5444 postgres(at)postgres=# \d repli_pkey
Index "public.repli_pkey"
Column | Type | Key? | Definition
--------+---------+------+------------
i | integer | yes | i
primary key, btree, for table "public.repli", invalid

[local]:5444 postgres(at)postgres=# \d repli
Table "public.repli"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
i | integer | | not null |
t | text | | |
Indexes:
"repli_pkey" PRIMARY KEY, btree (i) INVISIBLE INVALID
Publications:
"pub"

The attached patch adds the flag.

[local]:5444 postgres(at)postgres=# \d repli_pkey
Index "public.repli_pkey"
Column | Type | Key? | Definition
--------+---------+------+------------
i | integer | yes | i
primary key, btree, for table "public.repli", invalid, invisible

Attachment Content-Type Size
0002-Add-the-invisible-tag-for-indexes-in-d.patch text/x-patch 2.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2025-01-24 15:27:38 Re: XMLDocument (SQL/XML X030)
Previous Message Tom Lane 2025-01-24 15:24:06 Re: why -Fdance archive format option works with ./pg_restore but not with ./pg_dump?