From: Jeff Putsch <putsch@mxim.com>
To: pgsql-sql@postgresql.org
Subject: Help with UPDATE syntax
Date: Wed, 14 Mar 2001 22:47:29 -0800
Message-ID: <20010314224729.A16150@blue.mxim.com> (raw)
Howdy,
I am porting a bit of code from ORACLE to PostgreSQL 7.1 and am getting stuck on
an update statment. I am NOT a SQL expert, merely a beginner swimming hard,
so any help will be greatly appreciated. The specific query looks like this:
begin transaction
update
user_group_map map
set
user_id = 4
where
user_id = 9
not exists (
select * from
user_group_map
where
user_id = 4 and
group_id = map.group_id and
role = map.role
)
commit
There are other updates taking place during the transaction, but this is the
one for which I can't figure out the PostgreSQL equivalent.
I've tried this:
update
user_group_map
set
user_id = 4
from user_group_map map
where
user_id = 9 and
not exists (
select * from
user_group_map ug2
where
user_id = 4 and
ug2.group_id = map.group_id and
ug2.role = map.role);
for the update replacement, but get an error:
NOTICE: current transaction is aborted, queries ignored
until end of transaction block
As noted earlier, any guidance will be most appreciated.
Thanks,
Jeff.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: putsch@mxim.com
Subject: Re: Help with UPDATE syntax
In-Reply-To: <20010314224729.A16150@blue.mxim.com>
References: <20010314224729.A16150@blue.mxim.com>
* 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