Re: gexec from command prompt?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: gexec from command prompt?
Дата
Msg-id 20230112180408.b7hhh3ypdnthpa7i@alvherre.pgsql
обсуждение исходный текст
Ответ на gexec from command prompt?  (Ron <ronljohnsonjr@gmail.com>)
Список pgsql-general
On 2023-Jan-12, Ron wrote:

> 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

Yeah, what I use in these cases is something like

echo "select format('SELECT ''%s'', MIN(part_date) FROM %s;', table_name, table_name)
from dba.table_structure
order by table_name \gexec" | psql -f-


-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)



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