ecpg help with 7.3

Поиск
Список
Период
Сортировка
От Lee Kindness
Тема ecpg help with 7.3
Дата
Msg-id 15927.41311.724309.746303@kelvin.csl.co.uk
обсуждение исходный текст
Ответ на ecpg help with 7.3  ("Sid" <sbhatt@installs.com>)
Список pgsql-general
Sid,

Before 7.3, trying to insert an empty string into a number type column
would result in 0 being inserted into the column:

 lkind=# CREATE TABLE x(f INTEGER);
 CREATE
 lkind=# INSERT INTO x(f) VALUES ('');
 INSERT 859614628 1
 lkind=# SELECT * FROM x;
  f
 ---
  0
 (1 row)

With 7.3 an error is now output.

 lkind=# CREATE TABLE x(f INTEGER);
 CREATE TABLE
 lkind=# INSERT INTO x(f) VALUES ('');
 ERROR:  pg_atoi: zero-length string
 lkind=# SELECT * FROM x;
  f
 ---
 (0 rows)

Also you seem to be confusing the empty string with NULL - an empty
string is not a NULL value. To insert a NULL:

 lkind=# INSERT INTO x(f) VALUES (NULL);
 INSERT 28217013 1
 lkind=# SELECT * FROM x;
  f
 ---

 (1 row)

Lee.

Sid writes:
 > Hi all,
 >
 >    To start with we have recently migrated from v7.2.3 to v7.3, and I have
 > an embedded SQL code (ecpg) that used to work fine with 7.2.3. With the new
 > 7.3 it gives me an error when inserting into a table,
 > Cannot Insert in table xyz(-400):50 'ERROR: pg_atoi: zero-length string'
 > my first guess was that there was a zero length string (NULL) being inserted
 > in the table... but the attributes of the columns in the table are such that
 > they can accept NULL's too.
 > Having done this i tested the same data over 7.2.3 and it worked good. Can
 > somebody help me with this please .....
 >
 >
 > Thanks and regards
 > =Sid

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

Предыдущее
От: Iain Cox
Дата:
Сообщение: Unsubscribe
Следующее
От: Curt Sampson
Дата:
Сообщение: Re: Status of tablespaces