boolean <=> text explicit casts

Поиск
Список
Период
Сортировка
От Neil Conway
Тема boolean <=> text explicit casts
Дата
Msg-id 1180379601.6648.33.camel@goldbach
обсуждение исходный текст
Ответы Re: boolean <=> text explicit casts  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
I noticed that SQL:2003 specifies explicit casts between "boolean" and
the character string types. Attached is a patch that implements them,
and adds some simple regression tests.

A few points worth noting:

(1) The SQL spec requires that text::boolean trim leading and trailing
whitespace from the input

(2) The spec also requires that boolean::varchar(n) should raise an
error if "n" is not large enough to accomodate the textual
representation of the boolean value. We currently truncate:

=> select true::boolean::varchar(3);
 varchar
---------
 TRU

Not sure offhand if there's an easy way to satisfy the spec's
requirement...

(3) The spec suggests that true/false should be upper-cased when
converted to text, so that's what I've implemented, but one could argue
that converting to lower-case would be more consistent with PG's general
approach to case folding.

-Neil


Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Interval input: usec, msec
Следующее
От: Tom Lane
Дата:
Сообщение: Re: boolean <=> text explicit casts