dbTalk Databases Forums  

[BUGS] BUG #1381: invalid input syntax for integer: ""

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1381: invalid input syntax for integer: "" in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nicolas Addington
 
Posts: n/a

Default [BUGS] BUG #1381: invalid input syntax for integer: "" - 01-10-2005 , 11:30 PM







The following bug has been logged online:

Bug reference: 1381
Logged by: Nicolas Addington
Email address: adding (AT) math (DOT) wisc.edu
PostgreSQL version: 8.0
Operating system: aix
Description: invalid input syntax for integer: ""
Details:

When a pl/perl trigger for an insert event changes an integer column in the
new row to null, it fails. Interestingly, it doesn't have a problem if the
column was originally null.

create table tbl ( id integer primary key, n integer );

create function trg() returns trigger as $$
undef $_TD->{new}{n};
return 'MODIFY';
$$ language 'plperlu';

create trigger trg before insert on tbl for each row execute procedure
trg();

insert into tbl values (1, null);
INSERT 17997 1

insert into tbl values (2, 0);
ERROR: invalid input syntax for integer: ""

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1381: invalid input syntax for integer: "" - 01-11-2005 , 12:13 AM






"Nicolas Addington" <adding (AT) math (DOT) wisc.edu> writes:
Quote:
PostgreSQL version: 8.0
tsk, tsk --- it's not 8.0. Yet.

Quote:
When a pl/perl trigger for an insert event changes an integer column in the
new row to null, it fails. Interestingly, it doesn't have a problem if the
column was originally null.
Looks like we have to check *both* SvOK() and SvTYPE() everywhere.
Sigh. Done --- thanks for the report.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.