Re: Transactions and temp tables

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Emmanuel Cecchet <manu(at)frogthinker(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Transactions and temp tables
Date: 2008-11-18 20:46:11
Message-ID: 49232993.1050801@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas wrote:
> Somehow this feels pretty baroque, though. Perhaps a better approach
> would be to add a new AtPrepare_OnCommitActions function to tablecmds.c,
> that gets called before AtPrepare_Locks. It would scan through the
> on_commits list, and release all locks for the "PREPARE-safe" temp
> tables, and throw the error if necessary. I'll try that next.

Here's what I ended up with. I morphed the on commit action registration
into tracking of all temporary relations.

This only allows access to ON COMMIT DELETE ROWS temp tables. Accessing
other temporary tables, and creating or dropping tables in the
transaction is still forbidden.

It took me a couple of iterations to handle toast tables and indexes
correctly. More testing would be appreciated with more complex cases
like VACUUM FULL, subtransactions etc.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
2pc-temp-tables-heikki-2.patch text/x-diff 27.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dann Corbit 2008-11-18 21:15:28 Installation oddity -- installer insists that PostgreSQL has failed to start, even though it is started and functioning correctly
Previous Message Tom Lane 2008-11-18 20:04:36 Re: Reducing some DDL Locks to ShareLock