On Wed, Jun 18, 2014 at 9:00 AM, Stephen Frost <sfrost@snowman.net> wrote: > > > I have took some small time to make a PoC just to see if that is doable. > > And so I did a new syntax like: > > > > CREATE TABLESPACE spcname [TEMP | TEMPORARY] LOCATION ... > > > > So, if TEMP or TEMPORARY is present, I mark a new column at pg_tablespace > > as true. On every table creation or moving to a new tablespace, I just > > check this, and fails if the tablespace is "temporary" but the > > "relpersistence" says the table is not. > > Not sure about that specific syntax (don't we have SET options now?) but > I do like the general idea. >
Maybe something like that:
CREATE TABLESPACE spcname LOCATION '/foo/bar' WITH (only_temp_relations = true);
Have in mind you must take care if you use ALTER TABLESPACE spcname SET (...) to guarantee that exists only temp objects stored in the target tablespace, and if exists a regular object you must throw an exception.