gexec from command prompt?

Поиск
Список
Период
Сортировка
От Ron
Тема gexec from command prompt?
Дата
Msg-id 00a37956-d2b1-3749-9747-66d0d562ac90@gmail.com
обсуждение исходный текст
Ответы Re: gexec from command prompt?  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: gexec from command prompt?  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-general
Postgresql 12.11

This might be more of a bash question, or it might be a psql vs engine problem.

I want to run this query using psql from a bash prompt:
select format('SELECT ''%s'', MIN(part_date) FROM %s;', table_name, table_name)
from dba.table_structure
order by table_name\gexec

Thus, I added an extra back

$ psql sides -atXc "select format('SELECT ''%s'', MIN(part_date) FROM %s;', 
table_name, table_name) from dba.table_structure order by table_name limit 
5\\gexec"
select format('SELECT ''%s'', MIN(part_date) FROM %s;', table_name, 
table_name) from dba.table_structure order by table_name limit 5\gexec
ERROR:  syntax error at or near "\"
LINE 1: ...) from dba.table_structure order by table_name limit 5\gexec

Removing "\\exec" from the statement, and appending -c "\\gexec" to the psql 
command technically worked, but did not run the commands.

-- 
Born in Arizona, moved to Babylonia.



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

Предыдущее
От: Ron
Дата:
Сообщение: Re: AW: [Extern] Re: postgres restore & needed history files
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: gexec from command prompt?