Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?
Date
Msg-id Pine.LNX.4.30.0102151836410.1211-100000@peter.localdomain
Whole thread Raw
In response to Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
Tom Lane writes:

> Oh, I see.  So the question still remains: can a MULTIBYTE-aware backend
> ever use a sort order different from strcmp() order?  (That is, not as
> a result of LOCALE, but just because of the non-SQL-ASCII encoding.)

According to the code, no, because varstr_cmp() doesn't pay attention to
the multibyte status.  Presumably strcmp() and strcoll() don't either.

> Actually there are more complicated cases that would depend on more
> features of the encoding than just sort order.  Consider
>
>     CREATE INDEX fooi ON foo (upper(field1));
>
> Operations involving this index will misbehave if the behavior of
> upper() ever differs between MULTIBYTE-aware and non-MULTIBYTE-aware
> code.  That seems pretty likely for encodings like LATIN2...

Of course in the most general case this is a problem, because a function
can be implemented totally differently depending on any old #ifdef or
other external factors.

If the multibyte users think this check is okay, then I don't mind, since
it's usually what the users would want anyway.  I'm just pointing out the
technical issues.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Indexing new type ........
Next
From: Peter Eisentraut
Date:
Subject: Re: possible to create CVS branch for proposed patch?