Received: from mail.rdc1.wa.home.com (imail@ha1.rdc1.wa.home.com [24.0.2.66]) by hub.org (8.10.1/8.10.1) with ESMTP id e652CtS19436 for ; Tue, 4 Jul 2000 22:12:55 -0400 (EDT) Received: from cascadepg.com ([24.0.231.92]) by mail.rdc1.wa.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000705021253.AFU20205.mail.rdc1.wa.home.com@cascadepg.com> for ; Tue, 4 Jul 2000 19:12:53 -0700 Message-ID: <39629D1A.E6C8B9CD@cascadepg.com> Date: Tue, 04 Jul 2000 19:27:38 -0700 From: Dan Rosner Reply-To: rosner@scn.org Organization: Cascade Programming Group X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.5-15 i586) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: Inserting null values into a float4 field using Perl DBI Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200007/30 Greetings! Would anyone mind educating me about how to properly insert null values into a postgresql float4 field using perl DBI? I keep getting 0 in the field, instead of a NULL value as I would expect. Background: I'm using placeholders with DBI to read in data from a file. I do this a lot, as in this example: my $sth = $dbh->prepare_cached( q{ INSERT INTO mytable (field1, field2, field3) VALUES (?, ?, ?) }) ; open (FH, "< $path") or die "Unable to open $path: $!"; while () { chop; my ($field1, $field2, $field3) = split /,/; $sth->execute($field1, $field2, $field3); } close (FH); The sample file I'm reading has some Null values and looks like this: 1,2,3 4,,6 2,,6 7,8, 12,13,14 However, these values turn up in postgres table as 0, not NULL. When I do a select on the data read in with DBI, I get: 1,2,3 4,0,6 2,0,6 7,8,0 12,13,14 Would anyone mind telling me what I'm missing and/or point me to an example of how to do this properly. I'm using DBD::Pg 0.93 and postgres 7.02 on both NT and Linux. Thanks! Dan