Re: ALTER PUBLICATION

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: ALTER PUBLICATION
Дата
Msg-id CAKFQuwbW=fE2kkCn2rsdhVqYuMB=wD9MyKXfUrG+OG7t4m=kgQ@mail.gmail.com
обсуждение исходный текст
Ответ на ALTER PUBLICATION  (Lalith Tenneti <lalithkx@gmail.com>)
Список pgsql-admin
On Tuesday, October 30, 2018, Lalith Tenneti <lalithkx@gmail.com> wrote:
Hi All,

I am trying to run ALTER PUBLICATION ABC ADD TABLE <variable>. The variable is being set in a SELECT statement beforehand. But the ALTER statement adds the literal variable name. Is there anyway to acheive this? The reason is I do not want to hard code the table names.

=============

SQL doesn’t have variables and <variable> is not valid psql syntax.  If you are doing this in pl/pgsql you will need to use EXECUTE and dynamic SQL and inject the variable into the statement string using format(stmt, variable) where stmt = “... ADD TABLE %I”

David J.

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

Предыдущее
От: Lalith Tenneti
Дата:
Сообщение: ALTER PUBLICATION
Следующее
От: nunks
Дата:
Сообщение: Error code for "no partition or relation found for row"