Re: duplicate key violates unique constraint

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Shavonne Marietta Wijesinghe <shavonne(dot)marietta(at)studioform(dot)it>
Cc: Teemu Torma <teemu(at)torma(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: duplicate key violates unique constraint
Date: 2008-02-26 17:03:25
Message-ID: 20080226170325.GJ5763@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rodrigo E. De León Plicet 2008-02-26 17:09:28 Re: duplicate key violates unique constraint
Previous Message Bart Degryse 2008-02-26 16:59:57 Re: Function returns error (view)