Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prepared statement and inet type

Status
Not open for further replies.

AlbertAguirre

Programmer
Joined
Nov 21, 2001
Messages
273
Location
US
I prepared an insert statement into a postgres DB for a column that is an inet data type

I get the following error:
DBD::Pg::st execute failed: ERROR: invalid input syntax for type inet: "NULL"

Why?

I know I can insert a null into an inet type.
 
you can if you did not specify "not null" when creating the column in the table.

If not null was specified the data type is irrelevant.
 
nulls are allowed in the table. When I do a manual insert statement by typing out the sql statement it works. But with a prepared statement in perl it does not.

Ideas?
 
Can you show us the statement you are trying to use?
 
I think I figured it out.

I am using the ? placeholder in my prepare. The problem is that postgres requires a ' single quote in some columns and not in others.

With the ? placeholder perl places a ' single quote in all the values.

The solution was to prepare a statement WITHOUT the ? placeholder.

Any one disagree?
 
I have always just used a single quote for everything other than null's in postrgres
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top