Re: ALTER TABLE ... REPLACE WITH

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ... REPLACE WITH
Date: 2010-12-14 19:35:08
Message-ID: 4D07C6EC.2030200@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14.12.2010 20:27, Simon Riggs wrote:
> There are various applications where we want to completely replace the
> contents of a table with new/re-calculated data.
>
> It seems fairly obvious to be able to do this like...
> 1. Prepare new data into "new_table" and build indexes
> 2. Swap old for new
> BEGIN;
> DROP TABLE "old_table";
> ALTER TABLE "new_table" RENAME to "old_table";
> COMMIT;
>
> Step (2) works, but any people queuing to access the table will see
> ERROR: could not open relation with OID xxxxx

Could we make that work without error?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-12-14 19:36:31 Re: ALTER TABLE ... REPLACE WITH
Previous Message Josh Berkus 2010-12-14 19:34:16 Re: ALTER TABLE ... REPLACE WITH