Re: Transactions and temp tables

From: Emmanuel Cecchet <manu(at)frogthinker(dot)org>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
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-12-03 19:22:53
Message-ID: 4936DC8D.6070100@frogthinker.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I would really like to have support for temp tables at least for the
case where the table is created and dropped in the same transaction. But
I guess that the other limitations on index, sequences and views would
still hold, right?

manu

Heikki Linnakangas wrote:
> Emmanuel Cecchet wrote:
>> There is a problem with temp tables with on delete rows that are
>> created inside a transaction.
>> Take the 2pc_on_delete_rows_transaction.sql test case and change the
>> creation statement, instead of
>> create temp table foo(x int) on commit delete rows;
>> try
>> create temp table foo(x serial primary key) on commit delete rows;
>>
>> The test will fail. It looks like the onCommit field is not properly
>> updated when serial or primary key is used in that context. I did not
>> figure out why.
> A serial column uses a sequence behind the scenes.
>
> Hmm. Seems like we would need to treat sequences and indexes the same
> as tables with ON COMMIT DELETE ROWS, i.e release the locks early and
> don't error out.
>
> All in all, this is getting pretty messy. My patch felt a bit hackish
> to begin with, and having to add special cases for sequences and
> indexes would make it even more so. And what about temporary views?
> I'm starting to feel that instead of special-casing temp relations, we
> need to move into the opposite direction and make temp relations more
> like regular relations. Unfortunately, that's not going to happen in
> the 8.4 timeframe :-(. Let's try the other approach in 8.5.
>

--
Emmanuel Cecchet
FTO @ Frog Thinker
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: manu(at)frogthinker(dot)org
Skype: emmanuel_cecchet

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2008-12-03 19:24:08 Re: Simple postgresql.conf wizard
Previous Message Heikki Linnakangas 2008-12-03 18:33:19 Re: Visibility map, partial vacuums