On 07/18/2014 08:16 AM, Andrew Pennebaker wrote:
Could we please have the PostgreSQL lexer treat #!... on the first line
of a file as a comment? This would enable .psql scripts to be run with
dot-slash notation preferred by many unix users:

./script.psql

While still allowing the traditional (and Windows compatible) style:

psql -f script.psql

Would not doing the below accomplish the same thing for you?

http://www.postgresql.org/docs/9.3/interactive/app-psql.html

"Because of these legacy behaviors, putting more than one command in the -c string often has unexpected results. It's better to feed multiple commands to psql's standard input, either using echo as illustrated above, or via a shell here-document, for example:

psql <<EOF
\x
SELECT * FROM foo;
EOF
"

So:

#!/bin/sh
psql -d production -U aklaver <<EOF
\x
SELECT * FROM plant1;
EOF




--
Cheers,

Andrew Pennebaker
www.yellosoft.us <http://www.yellosoft.us>


--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to