Re: integer and ''

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: integer and ''
Дата
Msg-id 20050709230623.GA23292@wolff.to
обсуждение исходный текст
Ответ на integer and ''  (Verena Ruff <lists@triosolutions.at>)
Список pgsql-novice
On Sat, Jul 09, 2005 at 22:20:32 +0200,
  Verena Ruff <lists@triosolutions.at> wrote:
> Hi,
>
> I am using a php based application with postgresql and now I am in the
> progress migrating to pg 8.0.x.
>
> The problem is that this application produces statements like
> INSERT INTO table (a, b) VALUES ('1', '')
>
> where a and b are integers. This worked with pg7, but with pg8 I get an error:
> invalid value for integer: ''
>
> Is this a changed behaviour in the new version or is there just a parameter in
> the config file I don't know?

Empty strings aren't valid integers. This was considered a bug in older
versions and fixed a couple of releases ago. Use either 0, NULL or DEFAULT
depending on what you expect that to do.

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

Предыдущее
От: Verena Ruff
Дата:
Сообщение: integer and ''
Следующее
От: Søren Poulsen
Дата:
Сообщение: relation does not exist!?