Re: "ERROR: operator is not unique" with Custom Data Type
От | David E. Wheeler |
---|---|
Тема | Re: "ERROR: operator is not unique" with Custom Data Type |
Дата | |
Msg-id | 0D46D7ED-3B0A-4B85-9F25-B56684F877AA@kineticode.com обсуждение исходный текст |
Ответ на | Re: "ERROR: operator is not unique" with Custom Data Type (Martijn van Oosterhout <kleptog@svana.org>) |
Ответы |
Re: "ERROR: operator is not unique" with Custom Data Type
Re: "ERROR: operator is not unique" with Custom Data Type |
Список | pgsql-hackers |
On Jun 5, 2008, at 11:28, Martijn van Oosterhout wrote: > On Thu, Jun 05, 2008 at 11:18:26AM -0700, David E. Wheeler wrote: >> I'm working on a custom data type based on TEXT that does case- >> insensitive, locale-aware comparisons, essentially by calling LOWER() >> to compare values. > > What makes this different from the citext project? citext is not locale-aware; please Tom's comments in the "Case- Insensitve Text Comparison" thread. >> However, thanks to the implicit cast PostgreSQL finds more than one >> candidate operator when I compare properly casted values: >> >> try=# select 'a'::lctext = 'a'::text; >> ERROR: operator is not unique: lctext = text >> LINE 1: select 'a'::lctext = 'a'::text; >> ^ > > What would you want postgresql to choose in this case. I was thinking that the ::text should be cast to ::lctext, as that's how `'a'::lctext = 'a'` works, but I keep going back and forth in my mind. Maybe 'a'::lctext should not equal 'A'::text. > Whichever way > you want it, make that direction implicit and the other direction > assignment. I'm sure I'm missing something simple here. How do I make it assignment? > Having A->B and B->A both as implicit just leads to > ambiguity. Huh. That's what citext has, too: CREATE CAST (citext AS text) WITHOUT FUNCTION AS IMPLICIT; CREATE CAST (text AS citext) WITHOUT FUNCTION AS IMPLICIT; CREATE CAST (citext AS varchar) WITHOUT FUNCTION AS IMPLICIT; CREATE CAST (varchar AS citext) WITHOUT FUNCTION AS IMPLICIT; CREATE CAST (citext AS bpchar) WITHOUT FUNCTION AS IMPLICIT; CREATE CAST (bpchar AS citext) WITHOUT FUNCTION AS IMPLICIT; But I agree that there is confusion for PostgreSQL here. Thanks, David
В списке pgsql-hackers по дате отправления: