Re: Converting empty input strings to Nulls
От | Craig Ringer |
---|---|
Тема | Re: Converting empty input strings to Nulls |
Дата | |
Msg-id | 48419E72.3090603@postnewspapers.com.au обсуждение исходный текст |
Ответ на | Re: Converting empty input strings to Nulls ("Pavel Stehule" <pavel.stehule@gmail.com>) |
Список | pgsql-general |
Pavel Stehule wrote: > Hello > > 2008/5/31 Ken Winter <ken@sunward.org>: >> ... but an empty string still evokes the error even before this function is >> triggered. >> >> Is there a way to convert empty strings to Nulls before the error is evoked? >> > no - it's not possible. And some "magic" fix in triggers is bad style. The rule system may be able to handle this transformation (using insert rules or an updateable view). Getting it to work could be a bit arcane, though, and having never really delved into the rule system I can't be of much help. See: http://www.postgresql.com.cn/docs/8.3/static/rules.html http://www.postgresql.com.cn/docs/8.3/static/sql-createrule.html http://wiki.postgresql.org/wiki/Updatable_views http://wiki.postgresql.org/wiki/Introduction_to_PostgreSQL_Rules_-_Making_entries_which_can't_be_altered Personally, though, if at all possible I'd fix the broken client application. "" is NOT NULL . If you don't fix it, consider at least clearly documenting the wacky behaviour and if possible applying it only to an updatable view rather than the base table. -- Craig Ringer
В списке pgsql-general по дате отправления: