How to mix psql commands and SQL commands on the shell command line?

From: Aleksey Tsalolikhin <atsaloli(dot)tech(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: How to mix psql commands and SQL commands on the shell command line?
Date: 2012-12-07 19:58:41
Message-ID: CA+jMWocnYb_Lpw+cx12ZwNASFR9EwCeGsOwFNLhH-1YchVZ13w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How can I mix psql commands and SQL commands on the shell command line, please?

$ psql
psql (9.2.1)
Type "help" for help.

ddcKeyGen=> \timing \\ select count(*) from auth_users;
Timing is on.
count
-------
276
(1 row)

Time: 1.730 ms

$ psql -c "\timing \\ select count(*) from auth_users;"
Timing is on.
$

It seems like psql discards everything after the first psql
argument... Is there another way to mix psql and SQL commands on the
shell command line?

Best,
Aleksey

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-12-07 20:09:01 Re: How to mix psql commands and SQL commands on the shell command line?
Previous Message Tom Lane 2012-12-07 15:16:06 Re: logs encoding problem Windows