pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
Cc: Teemu Torma <teemu@torma.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: duplicate key violates unique constraint
Date: Tue, 26 Feb 2008 14:03:25 -0300
Message-ID: <20080226170325.GJ5763@alvh.no-ip.org> (raw)
In-Reply-To: <017901c87895$b1782380$3102a8c0@dream>
References: <014401c87887$a8fed450$3102a8c0@dream>
	<016401c87891$58237950$3102a8c0@dream>
	<20080226162246.GA9865@crankycanuck.ca>
	<200802261728.36773.teemu@torma.org>
	<017901c87895$b1782380$3102a8c0@dream>

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



view thread (17+ messages)  latest in thread

Message-ID: <20080226170325.GJ5763@alvh.no-ip.org>
Permalink:  ../20080226170325.GJ5763@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20080226170325.GJ5763@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@commandprompt.com, shavonne.marietta@studioform.it, teemu@torma.org
  Subject: Re: duplicate key violates unique constraint
  In-Reply-To: <20080226170325.GJ5763@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox