Re: Feature request: temporary schemas - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Feature request: temporary schemas
Date
Msg-id 54163422.9080205@aklaver.com
Whole thread Raw
In response to Feature request: temporary schemas  (cowwoc <cowwoc@bbs.darktech.org>)
Responses Re: Feature request: temporary schemas
List pgsql-general
On 09/14/2014 02:01 PM, cowwoc wrote:
> Hi,
>
> I'd like to propose the ability to create temporary schemas.
>
> Unlike temporary tables, this feature would enable developers to create a
> temporary schema once and execute CREATE TABLE statements without the
> TEMPORARY parameter.
>
> This would facilitate running unit tests, where developers would like to run
> the same creation script for unit tests and production code but do not wish
> to parameterize each CREATE TABLE statement (both environments are expected
> to execute identical scripts). It further enables the use of temporary
> functions, something which is not possible today (apparently you can hack
> this too, but there isn't an "official" way of doing so).
>
> See http://dba.stackexchange.com/q/76494/4719 for a related discussion.
>
> Should I move this discussion to a different mailing list or is this the
> correct location?

So from the above link and the discussion here so far I gather you want:

1) A CREATE TEMPORARY SCHEMA that behaves like CREATE TEMPORARY TABLE,
where it lasts only for a session and masks any existing schema and
contained objects with the same name for the duration.

2) You want to run this on a test database as so you can have 'masked'
tests over the permanent schema. Presumably because the tests can be
destructive and you do not want change the underlying structure and/or
data in your test database.

3) This needs to happen on the order of 4-10 times a second and it needs
to be tied to a session, as multiple transactions need to be run in each
test.

As to whether this is the appropriate list, I would say yes at least for
sounding out the idea. The list to address for dealing with the folks
that actually would implement the idea I would suggest --hackers.

In the meantime, the only way I can see doing this is creating and
dropping databases. Not sure that would meet your 4-10 times a second
requirement though.

>
> Thanks,
> Gili
>



--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Nick Guenther
Date:
Subject: Re: Feature request: temporary schemas
Next
From: cowwoc
Date:
Subject: Re: Feature request: temporary schemas