It seems that psql has no branching, and doesn’t support PL/pgSQL blocks either. How do people automate Postgres database actions? Should I write functions, and just call the functions from psql?
It seems that psql has no branching, and doesn’t support PL/pgSQL blocks either. How
Share
PostgreSQL 9.0 and up lets you execute an anonymous code block using a DO statement.
If you need to support earlier versions of Postgres, you could, within a transaction, create a stored procedure, execute it, and delete it.