Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id BD2801337B95 for ; Fri, 26 Nov 2010 04:59:31 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 89855-03 for ; Fri, 26 Nov 2010 08:59:25 +0000 (UTC) X-Greylist: delayed 00:06:41.854355 by SQLgrey-1.7.6 Received: from mail.bezdrat.net (mail.bezdrat.net [213.250.192.15]) by mail.postgresql.org (Postfix) with ESMTP id 26A3C1337B43 for ; Fri, 26 Nov 2010 04:59:24 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.bezdrat.net (Postfix) with ESMTP id 3397EC1CC; Fri, 26 Nov 2010 09:52:38 +0100 (CET) X-Virus-Scanned: amavisd-new at mail.bezdrat.net Received: from mail.bezdrat.net ([127.0.0.1]) by localhost (mail.bezdrat.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Oxa-RgGn0ShX; Fri, 26 Nov 2010 09:52:37 +0100 (CET) Received: from edas.lit.cz (edas.lit.cz [213.250.198.38]) by mail.bezdrat.net (Postfix) with ESMTP id 259D7C024; Fri, 26 Nov 2010 09:52:36 +0100 (CET) Message-ID: <4CEF7554.3020305@fortech.cz> Date: Fri, 26 Nov 2010 09:52:36 +0100 From: Martin Edlman User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Thunderbird/3.1.6 ThunderBrowse/3.3.3 MIME-Version: 1.0 To: Tom Lane CC: pgsql-bugs@postgresql.org Subject: Re: BUG #5770: Foreign key violation after insert References: <201011251252.oAPCqtHw055992@wwwmaster.postgresql.org> <14218.1290703969@sss.pgh.pa.us> In-Reply-To: <14218.1290703969@sss.pgh.pa.us> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 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: 201011/169 X-Sequence-Number: 28749 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Tom, > "Martin Edlman" writes: >> I encountered this problem during migration of the database from PgSQL 8.4 >> (where it works) to PgSQL 9.0.1. > > For me, this example fails on both 8.4 and 9.0. It works on both after > removing the ill-considered quote_literal call here: > >> INSERT INTO tmp.amavis_user (id, email, priority, policy_id) >> VALUES (NEW.id, quote_literal(NEW.email), prio, 1); > > Perhaps you tried to migrate away from using EXECUTE at the same time > you were converting to 9.0? Thank you very much for help. It works now. You're right, I've converted from EXECUTE to plain INSERT and I forgot to remove quote_literal() and then I didn't see that this was the problem. I'm glad that the problem was on my side and not in PgSQL. Regards, Martin Edlman -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAkzvdVQACgkQqmMakYm+VJ96iACeP4PpQuiXBxe7ylAJTHBH4Npl +n4AoINh4YeayAUcG3Z8wumoROwpx8bj =qfuC -----END PGP SIGNATURE-----