Search Postgresql Archives

CREATE TABLESPACE dynamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
2) The CREATE TABLESPACE command does not allow expressions.
  CREATE TABLESPACE foo LOCATION 'FOO' | 'BAR'
is not valid. I'm not sure I understand why since that is an expression that yields a string. Parenthesis don't help either.

Is there any way I can do this?



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux