(psqlrc and ~/.psqlrc ) are
ignored with this option.
+ command must be either
a command string that is completely parsable by the server (i.e.,
it contains no
psql -specific features),
or a single backslash command. Thus you cannot mix
meta-commands with this option. To achieve that, you could
- pipe the string into
psql ,
like
- this: echo '\x \\ SELECT * FROM foo;' | psql .
+ pipe the string into
psql ,
for example:
+ echo '\x \\ SELECT * FROM foo;' | psql .
(\\> is the separator meta-command.)
psql 's standard input. Also, only
the result of the last SQL command is returned.
+ 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
+
+