CREATE TABLESPACE dynamically

Поиск
Список
Период
Сортировка
От William Garrison
Тема CREATE TABLESPACE dynamically
Дата
Msg-id 45F86632.6000607@mobydisk.com
обсуждение исходный текст
Ответы Re: CREATE TABLESPACE dynamically  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
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?


В списке pgsql-general по дате отправления:

Предыдущее
От: Tony Caduto
Дата:
Сообщение: Re: How to write a function that manipulates a set of results
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: Debugging Server Code