Re: pg_collation_actual_version() ERROR: cache lookup failed for collation 123

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-02-22T07:27:17Z
Lists: pgsql-hackers
On Mon, Feb 22, 2021 at 06:34:22PM +1300, Thomas Munro wrote:
> On Thu, Feb 18, 2021 at 8:15 PM Michael Paquier <michael@paquier.xyz> wrote:
>> Could you just add a test with pg_collation_current_version(0)?
> 
> Done.
> 
>> +       pg_strncasecmp("POSIX.", collcollate, 6) != 0)
>>
>> I didn't know that "POSIX." was possible.
> 
> Yeah, that isn't valid on my (quite current) GNU or FreeBSD systems,
> and doesn't show up in their "locale -a" output, but I wondered about
> that theoretical possibility and googled it, and that showed that it
> does exist out there, though I don't know where/which versions,
> possibly only a long time ago.  You know what, let's just forget that
> bit, it's not necessary.  Removed.
> 
>> While on it, I guess that you could add tab completion support for
>> CREATE COLLATION foo FROM.
> 
> Good point.  Added.
> 
>> And shouldn't CREATE COLLATION complete
>> with the list of existing collation?
> 
> Rght, fixed.

Looks good to me, thanks!
--
Michael

Commits

  1. Tab-complete CREATE COLLATION.

  2. Refactor get_collation_current_version().

  3. pg_collation_actual_version() -> pg_collation_current_version().

  4. Hide internal error for pg_collation_actual_version(<bad OID>).