Re: pg_dump losing index column collations for unique and primarykeys - Mailing list pgsql-bugs

From Alexey Bashtanov
Subject Re: pg_dump losing index column collations for unique and primarykeys
Date
Msg-id 82921d03-9957-a3e5-09a0-d87b052104b5@imap.cc
Whole thread Raw
In response to Re: pg_dump losing index column collations for unique and primary keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_dump losing index column collations for unique and primary keys  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
> Well, I disagree that that's a high-priority use case, but it seems to me
> that you can still do it.  You just can't call the index the pkey until
> the column collation agrees.  So roughly it'd be
>
> * CREATE UNIQUE INDEX ... (col COLLATE new-collation)
> * Drop old pkey (the new index is still enforcing uniqueness)
> * ALTER TABLE ... ALTER COLUMN ... COLLATE new-collation
> * ALTER TABLE ADD PRIMARY KEY USING INDEX
>
> These seem to me to be pretty much exactly the same steps you'd need
> today, although maybe the current code is more forgiving about
> their ordering.
Agreed.
>> Disallowing changing the direction (ASC/DESC) also looks cruel to me.
> That restriction has been there since day one, and we have had a grand
> total of zero complaints about it.
True, my bad.

What do you think of making pg_dump warn the user if they are trying
to dump a weird PK/UK which has collations in index and column not matching?
And maybe even throw an error in case of --binary-upgrade?

>> BTW with playing with this stuff I came across another issue,
>> which seems unrelated to collations:
> Yeah, see
> https://www.postgresql.org/message-id/flat/10365.1558909428@sss.pgh.pa.us
> If you'd like to help move things along by reviewing that patch,
> it'd be great.
I'll have a look.

Best, Alex



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #16145: Not able to terminate active session
Next
From: Tomas Vondra
Date:
Subject: Re: BUG #16145: Not able to terminate active session