Re: CREATE COLLATION definitional questions for ICU

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE COLLATION definitional questions for ICU
Date: 2017-06-30 19:02:39
Message-ID: 2401.1498849359@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> On 6/25/17 11:45, Tom Lane wrote:
>> * Now that it's possible for user-created collations to have encoding -1,
>> I do not think that the "shadowing" tests in CollationCreate and
>> IsThereCollationInNamespace are sufficient. They don't prevent a new
>> collation with encoding -1 from shadowing an existing encoding-specific
>> collation that doesn't happen to match the current DB's encoding.
>> Now, you'd have to work at it for that to cause problems --- say,
>> create such a situation in template0 and then copy template0 specifying
>> that other encoding. But none of that is forbidden.

> I see. Do you have an idea how to fix it without too much overhead? We
> couldn't use the existing syscache for it.

I think you could use SearchSysCacheList to acquire a list of all
collations with the given name, and then run through it looking for
entries matching the target namespace. This doesn't seem too inefficient,
since the list would typically have length at most one.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-06-30 19:07:31 Re: [PATCH] doc: Fix typo
Previous Message Stephen Frost 2017-06-30 18:59:11 Re: pg_stop_backup(wait_for_archive := true) on standby server