CREATE TABLE LIKE and tablespaces

From: "David F(dot) Skoll" <dfs(at)roaringpenguin(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: CREATE TABLE LIKE and tablespaces
Date: 2013-02-27 18:29:35
Message-ID: 20130227132935.44fc25f1@hydrogen.roaringpenguin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

I have an application that creates a daily table from a "prototype"
table, so something like:

CREATE TABLE data_20130226 LIKE data_prototype INCLUDING DEFAULTS INCLUDING CONSTRATINTS INCLUDING INDEXES;

It would be really nice to be able to add:

INCLUDING TABLESPACE

so that the daily table goes into the same table space as the prototype
table. I can give a specific "TABLESPACE tablespace" clause, but then my
application needs to be aware that data_prototype is not in the default
tablespace. Ideally, I'd like the admin to be able to move data_prototype
into an alternate tablespace and have all the daily tables be created
in that same tablespace.

I suppose similar comments apply to INHERITS.

Thoughts?

Regards,

David.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Daniel Paval 2013-02-28 10:45:54 Data corruption / recover
Previous Message John Rouillard 2013-02-27 16:08:40 Re: logging full queries separately