Re: psql output result - Mailing list pgsql-general

From Adrian Klaver
Subject Re: psql output result
Date
Msg-id 9a745ad3-9527-d085-6a93-911f0e9a623d@aklaver.com
Whole thread Raw
In response to psql output result  (Tiffany Thang <tiffanythang@gmail.com>)
Responses Re: psql output result  (Tiffany Thang <tiffanythang@gmail.com>)
List pgsql-general
On 03/15/2018 07:57 AM, Tiffany Thang wrote:
> Hi,
> I have a SQL script that does some DDLs, inserts and counts.
> 
> The command I ran is
> psql dbname -c "\i crscript.sql" > output.txt
> 
> In output.txt, I got something like
> INSERT 0 1
> INSERT 0 1
> CREATE TABLE
> INSERT 0 2
>   count
> -------
>       9
> (1 row)
> 
> 
> Is there a way to output the SQLs and DDLs so that I could easily 
> identify what statements were executed?

aklaver@tito:~> psql -d test -U aklaver -a -f sql_test.sql
\pset null 'NULL'
Null display is "NULL".
CREATE TABLE tbl_test(fld_1 int, fld_2 varchar);
CREATE TABLE
INSERT INTO tbl_test VALUES (1, 'dog'), (2, 'cat');
INSERT 0 2
DROP TABLE tbl_test;
DROP TABLE

> 
> Thanks.
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Geoff Winkless
Date:
Subject: Re: psql output result
Next
From: Andy Halsall
Date:
Subject: Re: Question on corruption (PostgreSQL 9.6.1)