Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 4FF5DB5DBCB for ; Thu, 14 Jul 2011 17:00:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 03227-09 for ; Thu, 14 Jul 2011 20:00:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mbx.knossos.net.nz (mbx.knossos.net.nz [202.160.48.10]) by mail.postgresql.org (Postfix) with ESMTP id A7756B5DBC4 for ; Thu, 14 Jul 2011 17:00:52 -0300 (ADT) Received: from [10.1.1.3] (60-234-150-59.bitstream.orcon.net.nz [60.234.150.59]) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id p6EK0jo9001569 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 15 Jul 2011 08:00:47 +1200 Message-ID: <4E1F4AED.8060800@archidevsys.co.nz> Date: Fri, 15 Jul 2011 08:00:45 +1200 From: Gavin Flower Organization: ArchiDevSys User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Lightning/1.0b3pre Thunderbird/3.1.11 MIME-Version: 1.0 To: Tom Lane CC: Alvaro Herrera , Pg Bugs Subject: Re: Spurious errors relating to escaped single quotes References: <4E1ED6BC.9020709@archidevsys.co.nz> <1310661849-sup-6899@alvh.no-ip.org> <7689.1310670857@sss.pgh.pa.us> In-Reply-To: <7689.1310670857@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201107/122 X-Sequence-Number: 30734 On 15/07/11 07:14, Tom Lane wrote: > Alvaro Herrera writes: >> Excerpts from Gavin Flower's message of jue jul 14 07:45:00 -0400 2011: >>> Using pg 9.1beta3, I was found that running a function generated an >>> error relating to escaped single quotes, yet still produced the answer I >>> expected! >> The errors are not spurious. The function doesn't exist now because it >> didn't get created. What happened is that now your inserts are going >> into the parent table, not the partitions as your script intended. > Possibly a more useful answer is "your function appears to be assuming > that standard_conforming_strings is OFF. As of 9.1 it's ON by default". > > regards, tom lane Thanks Tom (& Alvera), I checked my postgresql.conf: standard_conforming_strings = off I had forgotten I had changed this, and had simply reussed it from earlier! The silly thing is, that I had been treading up on partitioned tables and had come across a comment about mistakes could lead to populating the parent table! If I could change the sunject of thread, I would change it to start with 'Misleading...'. My lawyer siuggests defences of 'tiredness due ti it being late at night' and 'poor eyesight'! :-) (You can tell I've been reading groklaw.net way too much)) More seriously: Could a hint be put in after the error message: 'psql:part000.sql:68: ERROR: function measurement_insert_trigger() does not exist' when the table has been partitioned, along the lines that 'this might cause inserts to go into the parent table, is this intended?' or some such? I am sure many others also get caught. This was purely an exercise for me, but it would be more serious in production code (yes I know things 'should' be tested properly first...). Cheers, Gavin