Re: Inserting values into numeric fields - Mailing list pgsql-sql

From Jason Earl
Subject Re: Inserting values into numeric fields
Date
Msg-id 87y9ft23cg.fsf@npa01zz001.simplot.com
Whole thread Raw
In response to Inserting values into numeric fields  ("Eric Carpenter" <postgresql@slacker.to>)
List pgsql-sql
"Eric Carpenter" <postgresql@slacker.to> writes:

> Greetings all,
> 
> I'm trying to insert values into a numeric field which may be
> optional. I'm using perl's DBI and bind parameters to do
> this. However, psotgresql complains that '' is not a numeric, since
> the DBI quotes everything before inserting.. I've tried inserting
> NULL as well, but that gets quoted and rejected as well.
> 
> Is there any way to do this without hard coding "NULL" into the
> prepared statement handle?

It's been a long time since I used Perl with PostgreSQL but it seems
DBI will insert null values if you pass them variables that are
undefined.  Try using undef() and see what you get.

Good luck,
Jason


pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Transactional vs. Read-only (Retrieval) database
Next
From: Markus Wagner
Date:
Subject: how to get more detailed error messages?