Re: CREATE TABLESPACE dynamically

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: William Garrison <postgres(at)mobydisk(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE TABLESPACE dynamically
Date: 2007-03-15 21:18:01
Message-ID: 45F9B809.1080005@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:
> William Garrison wrote:
>> I am writing scripts to create a database that I want to run in my
>> development, testing, and production environments. That means I need
>> to be able to do something like
>>
>> IF <condition>
>> CREATE TABLESPACE foo LOCATION E'C:\database';
>> ELSE
>> CREATE TABLESPACE foo LOCATION E'Z:\database';
>>
>> I can't seem to find a way to do this, for two reasons:
>> 1) I can't do IF statements unless I create a PL/PGSQL function. And
>> a PL/PGSQL function cannot issue a CREATE TABLESPACE command.

Windows (at least XP & 2003 Server) actually supports real symbolic
links, even if they are not exposed through the UI provided by explorer.
They are called "junktions" on windows, and you can only create linsk to
directories, not to files. But you could use them to e.g. create a link
from C:\postgres.data to E:\postgres.data on one machine, and to
F:\postgres.data on another. Than you can just write "LOCATION
C:\postgres.data" in your script, and it will still use the correct
partition.

This is not an answer to your question, but maybe it's an easier
solution to your problem.

greetings, Florian Pflug

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Lambert 2007-03-15 21:18:41 Re: PgSql on Vista?
Previous Message Florian G. Pflug 2007-03-15 21:11:28 Re: Native type for storing fractions (e.g 1/3)?