Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 24648476567 for ; Tue, 1 Oct 2002 12:54:48 -0400 (EDT) Received: from web14410.mail.yahoo.com (web14410.mail.yahoo.com [216.136.173.221]) by postgresql.org (Postfix) with SMTP id 718764764CD for ; Tue, 1 Oct 2002 12:54:47 -0400 (EDT) Message-ID: <20021001165453.882.qmail@web14410.mail.yahoo.com> Received: from [64.1.187.234] by web14410.mail.yahoo.com via HTTP; Tue, 01 Oct 2002 09:54:53 PDT Date: Tue, 1 Oct 2002 09:54:53 -0700 (PDT) From: test test Subject: Inserting Null Value or String Value To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1322507064-1033491293=:761" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/1 X-Sequence-Number: 1516 --0-1322507064-1033491293=:761 Content-Type: text/plain; charset=us-ascii Hi, I am trying to insert a date into a date field, but also sometimes I need to insert a null value. Inserting the null value seems to require not using quotes around null, but if I try to enter a date without quotes around it, it thinks it is a number. Here is the error I get: Warning: PostgreSQL query failed: ERROR: column "spec_start_date" is of type 'date' but expression is of type 'integer' You will need to rewrite or cast the expression The value I am sending is: spec_start_date = 10/01/02 If I surround the date with single quotes it should be fine, but I can't do that when I want to insert a null value. I know that I can do an "IF ELSE " in the SQL string, by I am entering many values and this would really get messy. I was hoping that there was a better solution. Thanks for any help. Sean --------------------------------- Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! --0-1322507064-1033491293=:761 Content-Type: text/html; charset=us-ascii

Hi,

I am trying to insert a date into a date field, but also sometimes I need to insert a null value.  Inserting the null value seems to require not using quotes around null, but if I try to enter a date without quotes around it, it thinks it is a number.

Here is the error I get: Warning: PostgreSQL query failed: ERROR: column "spec_start_date" is of type 'date' but expression is of type 'integer' You will need to rewrite or cast the expression

The value I am sending is: spec_start_date = 10/01/02

If I surround the date with single quotes it should be fine, but I can't do that when I want to insert a null value.  I know that I can do an "IF <use quotes> ELSE <don't use quotes>" in the SQL string, by I am entering many values and this would really get messy. I was hoping that there was a better solution. Thanks for any help.

Sean



Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo! --0-1322507064-1033491293=:761--