Re: boolean <=> text explicit casts

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: boolean <=> text explicit casts
Дата
Msg-id 8305.1180381122@sss.pgh.pa.us
обсуждение исходный текст
Ответ на boolean <=> text explicit casts  (Neil Conway <neilc@samurai.com>)
Ответы Re: boolean <=> text explicit casts  (Neil Conway <neilc@samurai.com>)
Re: boolean <=> text explicit casts  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> (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.

Really?  That's in direct contradiction to the "normal" spec-required
behavior of casting to varchar(n).  I'd suggest ignoring it on the
grounds that the SQL committee have forgotten what they wrote
themselves.

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

hm, +1 for lower case myself, but not dead set on it.

More generally, I'm really hoping to get rid of bespoke text<->whatever
cast functions in favor of using datatypes' I/O functions.  To what
extent can we make the boolean I/O functions serve for this?  It seems
relatively painless on the input side --- just allow whitespace --- but
I suppose we can't change boolout's historical result of "t"/"f" without
causing problems.

Also, invoking btrim() seems an exceedingly expensive way of ignoring a
bit of whitespace.  I suppose inefficiency in a seldom-used cast
function does not matter, but please don't do it that way in boolin.

            regards, tom lane

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

Предыдущее
От: Neil Conway
Дата:
Сообщение: boolean <=> text explicit casts
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Seq scans status update