ecpg help with 7.3

From: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
To: "Sid" <sbhatt(at)installs(dot)com>
Cc: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: ecpg help with 7.3
Date: 2003-01-29 09:39:43
Message-ID: 15927.41311.724309.746303@kelvin.csl.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Curt Sampson 2003-01-29 10:28:20 Re: Status of tablespaces
Previous Message Iain Cox 2003-01-29 09:24:39 Unsubscribe