Re: OCTET_LENGTH is wrong

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, peter_e(at)gmx(dot)net, barry(at)xythos(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: OCTET_LENGTH is wrong
Date: 2001-11-23 16:12:53
Message-ID: 3BFE7585.F0AA04E7@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>
> Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> > Yes. Consider you have UNICODE database and want to sort by French or
> > whatever LATIN locale.
> > SELECT * FROM t1 ORDER BY convert(text_column,'LATIN1');
> > would be the only way to accomplish that.
>
> That in itself would not get the job done; how is the sort operator
> to know what collation order you want?
>
> The SQL92 spec suggests that the syntax should be
>
> ... ORDER BY text_column COLLATE French;
>
> (note collation names are not standardized AFAICT). Seems to me it
> should then be the system's responsibility to make this happen,
> including any encoding conversion that might be needed before the
> comparisons could be done.

Thanks to postgreSQL's flexibility you can currently make a contrib
function convert(text_column,'LATIN1',locale) that returns a (new)
text_with_locale type that has locale_aware comparison operators.

--------------
Hannu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-11-23 16:23:30 Re: Unescaped new lines in postgres
Previous Message mlw 2001-11-23 16:10:33 Re: beta3