Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 56DB2475BC3 for ; Tue, 15 Oct 2002 10:14:44 -0400 (EDT) Received: from jefftrout.com (h00a0cc4084e5.ne.client2.attbi.com [24.128.215.169]) by postgresql.org (Postfix) with SMTP id AE88D475B84 for ; Tue, 15 Oct 2002 10:14:39 -0400 (EDT) Received: (qmail 65050 invoked from network); 15 Oct 2002 14:14:01 -0000 Received: from h00a0cc4084e5.ne.client2.attbi.com (threshar@24.128.215.169) by h00a0cc4084e5.ne.client2.attbi.com with SMTP; 15 Oct 2002 14:14:01 -0000 Date: Tue, 15 Oct 2002 10:14:01 -0400 (EDT) From: Jeff X-X-Sender: threshar@torgo To: Peter Galbavy Cc: "pgsql-sql@postgresql.org" Subject: Re: how do i insert an empty string ? In-Reply-To: <000901c27431$e02a8e20$4528a8c0@cblan.mblox.com> Message-ID: <20021015101157.X65014-100000@torgo> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/163 X-Sequence-Number: 9880 On Tue, 15 Oct 2002, Peter Galbavy wrote: > FAQ: A search yielded nothing explicit... > > I have an INSERT statement: > > INSERT INTO metadata (md5, origin, name, value) > VALUES ('fd859f263bd0579935f2146a22d24f32', 'EXIF', > 'UserComment', '') > > but this fails (using Perl DBI, DBD::Pg) because $dbh->quote() returns two Since you are using DBI, why not bind the variables and be done with it? this would become $query = $db->prepare("INSERT INTO metadata (md5, origin, name, value) VALUES (?, ?, ?, ?)"); $query->execute($md5, $origin, $name, $value); This way you don't have to deal with double quoting and all that. (You can also call bind_param, but I find it easier to just pass args into execute) ------------------------------------------------------------------------------ Jeff Trout http://www.jefftrout.com/ Ronald McDonald, with the help of cheese soup, controls America from a secret volkswagon hidden in the past -------------------------------------------------------------------------------