From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: ALTER tbl rewrite loses CLUSTER ON index
Date: Thu, 12 Mar 2020 13:19:56 -0400
Message-ID: <25886.1584033596@sss.pgh.pa.us> (raw)
In-Reply-To: <20200303013625.GA21225@telsasoft.com>
References: <20200206144426.GH403@telsasoft.com>
<20200206172447.GA28041@alvherre.pgsql>
<20200207143935.GP403@telsasoft.com>
<17937.1582932364@sss.pgh.pa.us>
<20200229024202.GH29456@telsasoft.com>
<20200229165258.GJ29456@telsasoft.com>
<20200302032818.GB32059@paquier.xyz>
<20200303013132.GA684@telsasoft.com>
<20200303013625.GA21225@telsasoft.com>
Justin Pryzby <pryzby@telsasoft.com> writes:
> @cfbot: resending with only Amit's 0001, since Michael pushed a variation on
> 0002.
Boy, I really dislike this patch. ATPostAlterTypeParse is documented as
using the supplied definition string, and nothing else, to reconstruct
the index. This breaks that without even the courtesy of documenting
the breakage. Moreover, the reason why it's designed like that is to
avoid requiring the old index objects to still be accessible. So I'm
surprised that this hack works at all. I don't think it would have
worked at the time the code was first written, and I think it's imposing
a constraint we'll have problems with (again?) in future.
The right way to fix this is to note the presence of the indisclustered
flag when we're examining the index earlier, and include a suitable
command in the definition string. So probably pg_get_indexdef_string()
is what needs to change. It doesn't look like that's used anywhere
else, so we can just redefine its behavior as needed.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pryzby@telsasoft.com, michael@paquier.xyz, alvherre@2ndquadrant.com, amitlangote09@gmail.com
Subject: Re: ALTER tbl rewrite loses CLUSTER ON index
In-Reply-To: <25886.1584033596@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox