Languages
[Edit]
EN

Postgres - execute SQL query from command line

9 points
Created by:
Marcin
19490

In this short article, we would like to show how to execute a query on the Postgress database from the command line.

Quick solution:

echo "SELECT 1" | psql postgres://my-username:my-password@localhost:5432/my-database ON_ERROR_STOP=1 --single-transaction

See also

  1.  PostgreSQL - execute SQL query from file using command line
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join