Re: gexec from command prompt? - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: gexec from command prompt?
Date
Msg-id 20230112180408.b7hhh3ypdnthpa7i@alvherre.pgsql
Whole thread Raw
In response to gexec from command prompt?  (Ron <ronljohnsonjr@gmail.com>)
List 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 by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: gexec from command prompt?
Next
From: "David G. Johnston"
Date:
Subject: Re: gexec from command prompt?