Received: from mail.flutterby.com (www.flutterby.com [209.140.49.28]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1RJZgx97786 for ; Tue, 27 Feb 2001 14:35:42 -0500 (EST) (envelope-from danlyke@flutterby.com) Received: from wynand.flutterby.com (c1294852-a.marin1.sfba.home.com [65.11.14.11]) by mail.flutterby.com (8.9.3/8.9.3/Debian/GNU) with ESMTP id LAA21966 for ; Tue, 27 Feb 2001 11:36:23 -0800 Received: (from danlyke@localhost) by wynand.flutterby.com (8.9.3/8.9.3/Debian 8.9.3-21) id LAA02745; Tue, 27 Feb 2001 11:25:16 -0800 From: Dan Lyke MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15003.65308.557357.318833@wynand.flutterby.com> Date: Tue, 27 Feb 2001 11:25:16 -0800 (PST) To: pgsql-interfaces@postgresql.org Subject: Double newline bug with DBD::Pg: Where best to fix? X-Mailer: VM 6.72 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-Archive-Number: 200102/183 X-Sequence-Number: 1147 If, using DBI with DBD::Pg, you call $dbh->do('INSERT INTO xyz(stuff) VALUES(' $dbh->quote("a string with \n\n a two line break").')'); You'll get a string with a single line break back, because DBD::Pg doesn't escape newlines into '\n'. This is consistent with the interface via psql: test=# insert into xyz(stuff) values('a string with test'# test'# a two line break'); test=# select stuff from xyz; stuff ---------------------------------- a string with a two line break (1 row) (As you can see there are also some interesting issues with leading spaces going on here). I don't have a copy of the SQL standard in front of me, so I'm not sure whether this needs to be fixed in the PostgreSQL parser (seems like the logical place, but we're into minutae of compatibility) or DBD::Pg (the easy place, but maybe this is a hack that's going to have to go in every interface). I also haven't tested with putting the string inside the $sth->execute(...) call, and haven't dug through enough of the DBI code to know how exactly that gets passed to the underlying driver. Anyway, I've got over 4000 records that need to get fixed by hand because of this, and want to make sure nobody else gets bitten, and would like to implement a solution that doesn't require me remembering to patch things every time I upgrade. Dan