Re: Weirdness in CHECK?

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Weirdness in CHECK?
Дата
Msg-id NEBBIOAJBMEENKACLNPCOEMOCCAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Weirdness in CHECK?  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Список pgsql-hackers
> I think some people feel that we ought to raise an error rather than
> silently truncating the input.  However, given that we do intend to
> truncate the input, it seems to me that applying CHECK constraints
> post-truncation is the Right Thing.  In general a CHECK ought to be
> applied after any conversion ops needed to create a value of the
> destination column type.  For example, if I had "CHECK (foo < 1)"
> on a column foo declared NUMERIC(3,2), I'd be unhappy if the input
> "0.999" got past the check because it was rounded to 1.00 only after
> the CHECK was applied.

Agreed.  However, my complaint is with the error message.  I spent half an
hour dumping and recreating my tables, messing with the catalogs, etc.
because I could not for the life of me figure out what was wrong with my
CHECKs!  Why wouldn't it accept 'VOLUME' when 'VOLUME' was clearly being
passed by the CHECK!  It drove me nuts until I noticed that I'd accidentally
set the CHAR length too low.

Chris



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Weirdness in CHECK?
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Please review TODO list