Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 87DE12E009E for ; Tue, 26 Feb 2008 13:04:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 74041-01-2 for ; Tue, 26 Feb 2008 13:04:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-159.commandprompt.net [207.173.203.159]) by postgresql.org (Postfix) with ESMTP id 3D69F2E00E3 for ; Tue, 26 Feb 2008 13:03:28 -0400 (AST) Received: from perhan.alvh.no-ip.org (200-126-103-57.bk7-dsl.surnet.cl [200.126.103.57]) (authenticated bits=0) by lists.commandprompt.com (8.13.8/8.13.8) with ESMTP id m1QH3m3u014053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 26 Feb 2008 09:03:51 -0800 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 2F2BE47BF6; Tue, 26 Feb 2008 14:03:25 -0300 (CLST) Date: Tue, 26 Feb 2008 14:03:25 -0300 From: Alvaro Herrera To: Shavonne Marietta Wijesinghe Cc: Teemu Torma , pgsql-sql@postgresql.org Subject: Re: duplicate key violates unique constraint Message-ID: <20080226170325.GJ5763@alvh.no-ip.org> References: <014401c87887$a8fed450$3102a8c0@dream> <016401c87891$58237950$3102a8c0@dream> <20080226162246.GA9865@crankycanuck.ca> <200802261728.36773.teemu@torma.org> <017901c87895$b1782380$3102a8c0@dream> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <017901c87895$b1782380$3102a8c0@dream> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (lists.commandprompt.com [207.173.203.159]); Tue, 26 Feb 2008 09:03:51 -0800 (PST) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/211 X-Sequence-Number: 30302 Shavonne Marietta Wijesinghe wrote: > I wrote the query in the SQL windows provided by the pgadmin. That SQL window only executes SQL, so you can't use PL/pgSQL commands on it. PL/pgSQL can only be used in the context of a PL/pgSQL function, so you need to do CREATE FUNCTION to do that. If you want to use the SQL window you could use SAVEPOINT and ROLLBACK TO. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support