X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 20D57D6F81 for ; Sat, 27 Aug 2005 11:56:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53152-03 for ; Sat, 27 Aug 2005 14:56:43 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5399CD6ED6 for ; Sat, 27 Aug 2005 11:56:42 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j7REulCb001354; Sat, 27 Aug 2005 10:56:47 -0400 (EDT) To: bhv@quebecemail.com Cc: pgsql-sql@postgresql.org Subject: Re: Unwanted nested dollar-quoted constants In-reply-to: <20050820122715.D2B562D6@dm22.mta.everyone.net> References: <20050820122715.D2B562D6@dm22.mta.everyone.net> Comments: In-reply-to Bernard Henry Voynet message dated "Sat, 20 Aug 2005 12:27:15 -0700" Date: Sat, 27 Aug 2005 10:56:47 -0400 Message-ID: <1353.1125154607@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200508/263 X-Sequence-Number: 22491 Bernard Henry Voynet writes: > All the text fields are specified using the dollar-quoted string constant form that. This is your mistake to start with. You can not simply stick a couple of dollar signs around a random string and expect to have a valid literal, any more than you can stick a couple of quote marks around it and expect to have a valid literal. Dollar-quoting is not a magic bullet that will let you forget about escaping data. I would recommend going back to regular quoted literals and making sure you double any quotes or backslashes in the data. It's possible to develop appropriate code for dollar-quoting random text, but it's a lot harder than it is to escape the data in the old style. regards, tom lane