Re: Create Schema functionality question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Create Schema functionality question
Дата
Msg-id 18533.1077602293@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Create Schema functionality question  (Seamus Thomas Carroll <carrolls@cpsc.ucalgary.ca>)
Ответы Re: Create Schema functionality question
Список pgsql-general
Seamus Thomas Carroll <carrolls@cpsc.ucalgary.ca> writes:
> Is there any possible way to create a schema without having
> to hard code the name?

Not in CREATE SCHEMA itself.  But you could use a plpgsql or pltcl
function to construct the needed command as a string, and execute
that.  In plpgsql it'd look something like

    DECLARE newschema text;
    ...
    SELECT INTO newschema agent_schema FROM ... WHERE ...;
    EXECUTE "CREATE SCHEMA " || quote_ident(newschema);
    ...

The same goes for other utility commands (which is to say everything
except SELECT/INSERT/UPDATE/DELETE).

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Found this in the server log on MAC OSX
Следующее
От: Seamus Thomas Carroll
Дата:
Сообщение: Re: Create Schema functionality question