1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Send A Command To psql as a postgres til.

This commit is contained in:
jbranchaud
2015-07-07 19:44:35 -05:00
parent cf7ad68f52
commit 3b5ffd549f
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# Send A Command To psql
You can send a command to `psql` to be executed by using the `-c` flag
```bash
$ psql -c "select 'Hello, World!';"
?column?
---------------
Hello, World!
(1 row)
```
Specify a particular database as needed
```bash
$ psql blog_prod -c 'select count(*) from posts;'
count
-------
8
(1 row)
```
h/t Jack Christensen