Re: psql variable interpolation with subsequent underscore

Поиск
Список
Период
Сортировка
От Bosco Rama
Тема Re: psql variable interpolation with subsequent underscore
Дата
Msg-id 527D25EF.60609@boscorama.com
обсуждение исходный текст
Ответ на Re: psql variable interpolation with subsequent underscore  (Tim Kane <tim.kane@gmail.com>)
Ответы Re: psql variable interpolation with subsequent underscore
Список pgsql-general
On 11/08/13 09:30, Tim Kane wrote:
>
> Remi, to answer your question - this is being called as part of a shell
> script.

In that case your options expand greatly...

For example:
   tbl_name="YYYYMM"

   psql -c "alter table my_table rename to my_table_${tbl_name}_raw;"

or for more complex stuff:
   tbl_name="YYYYMM"

   psql -f- <<EOF
       alter table my_table rename to my_table_${tbl_name}_raw;
       ... <other DML/DDL>
   EOF

Or even:
   (
       <bunch of commands generating SQL DML/DDL>

   ) | psql -f-

Or ...

The sky's the limit once you remove the restriction of working 100%
*within* psql itself.

HTH

Bosco.


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

Предыдущее
От: Tim Kane
Дата:
Сообщение: Re: psql variable interpolation with subsequent underscore
Следующее
От: John R Pierce
Дата:
Сообщение: Re: psql variable interpolation with subsequent underscore