update before drop causes OID problems in transaction?

From: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: update before drop causes OID problems in transaction?
Date: 2006-03-17 22:41:58
Message-ID: Pine.LNX.4.64.0603171434230.11424@discord.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Not sure if this is the best list for this issue, but I ran into something
that I thought should work inside a transaction, but obviously PostgreSQL
thought otherwise.

Postgres version is 8.1.3. The transaction I wrote is basically:

BEGIN;
DROP RULE foo_audit_no_update ON foo_audit;

UPDATE foo_audit SET modified_by = 1
WHERE modified_by IS NULL;

I then copy the data out of foo_audit into some temporary tables,
drop foo_audit, alter table foo as I want it to be, then recreate foo_audit
and all the triggers, functions, copy the data back into foo_audit from the
temp tables and then

COMMIT;

After commit, I get a lovely:

ERROR: could not open relation with OID x

Is this expected? To solve this, I simply moved my initial update outside the
transaction.

--
Jeff Frost, Owner <jeff(at)frostconsultingllc(dot)com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-03-17 22:52:49 Re: update before drop causes OID problems in transaction?
Previous Message Robert Treat 2006-03-17 21:35:35 Re: in PlPgSQL function, how to use variable in a "select ...