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

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: peter_e(at)gmx(dot)net
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?
Date: 2001-02-16 02:14:39
Message-ID: 20010216111439L.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Right.

> > 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.

Right. However, Tom's point is a little bit different, I guess.

As far as I know, most builtin functions taking string data types as
their aruguments would behave same with/without MULTIBYTE. As far as
I know exceptions include:

char_length
quote_ident
quote_literal
ascii
to_ascii

So, for example,

CREATE INDEX fooi ON foo (char_length(field1));

would behave differently with/without MULTIBYTE if the encoding for
the database is not "single byte type".
--
Tatsuo Ishii

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-16 03:55:47 Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?
Previous Message Bruce Momjian 2001-02-16 01:14:21 Apology for ODBC mistakes