Re: How to get pgsql to echo commands in a command file - Mailing list pgsql-sql

From Michael Moore
Subject Re: How to get pgsql to echo commands in a command file
Date
Msg-id CACpWLjPHdW=oUyHSFKobFG8ZDXhrTCFetbkWHwPgc7Pr2Du2SA@mail.gmail.com
Whole thread Raw
In response to Re: How to get pgsql to echo commands in a command file  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-sql
<div dir="ltr">Thanks guys!</div><div class="gmail_extra"><br /><div class="gmail_quote">On Fri, Apr 22, 2016 at 3:58
PM,Adrian Klaver <span dir="ltr"><<a href="mailto:adrian.klaver@aklaver.com"
target="_blank">adrian.klaver@aklaver.com</a>></span>wrote:<br /><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px#ccc solid;padding-left:1ex"><span class="">On 04/22/2016 03:50 PM, Michael Moore wrote:<br
/><blockquoteclass="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I log into
pgsqland then type:<br /> \i test.sql<br /><br /> test.sql contains a single SELECT command and when I run that file I
see<br/> the result of the select command.. The problem is, I also want to see<br /> the SELECT command itself.<br
/><br/> I've tried<br /> /echo<br /> /qecho<br /> and a lot of other commands, but nothing works.<br /></blockquote><br
/></span><ahref="http://www.postgresql.org/docs/9.5/interactive/app-psql.html" rel="noreferrer"
target="_blank">http://www.postgresql.org/docs/9.5/interactive/app-psql.html</a><br/> "<br /> ECHO<br /><br />     If
setto all, all nonempty input lines are printed to standard output as they are read. (This does not apply to lines read
interactively.)To select this behavior on program start-up, use the switch -a. If set to queries, psql prints each
queryto standard output as it is sent to the server. The switch for this is -e. If set to errors, then only failed
queriesare displayed on standard error output. The switch for this is -b. If unset, or if set to none (or any other
valuethan those above) then no queries are displayed.<br /> "<br /><br /><br /> aklaver@panda:~> cat
psql_test.sql<br/> select * from a ;<br /><br /> aklaver@panda:~> psql -a -d test -U  postgres -h localhost<br />
psql(9.4.6)<br /> SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression:
off)<br/> Type "help" for help.<br /><br /> test=# \i psql_test.sql<br /> select * from a ;<br />  id | v1 | v2 | v3<br
/>----+----+----+----<br />   1 |  2 |  3 |  4<br />   2 |  2 |  3 |  4<br /> (2 rows)<div class="HOEnZb"><div
class="h5"><br/><br /><br /><br /><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex"><br/> What do I need to do in order to see the commands in test.sql as well as<br /> the output
ofthose commands on my pgsql window?<br /><br /> I'm running on Windows 7 if that matters.<br /><br /> TIA,<br />
Mike<br/></blockquote><br /><br /></div></div><span class="HOEnZb"><font color="#888888"> -- <br /> Adrian Klaver<br
/><ahref="mailto:adrian.klaver@aklaver.com" target="_blank">adrian.klaver@aklaver.com</a><br
/></font></span></blockquote></div><br/></div> 

pgsql-sql by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: How to get pgsql to echo commands in a command file
Next
From: "Venkatesan, Sekhar"
Date:
Subject: Re: Re: PostgreSQL:ALTER TABLE command hangs forever when DB partitioning is enabled.