pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Suggestion for psql: --file -
4+ messages / 2 participants
[nested] [flat]

* Suggestion for psql: --file -
@ 2001-01-30 22:20  Albert REINER <areiner@tph.tuwien.ac.at>
  0 siblings, 1 reply; 4+ messages in thread

From: Albert REINER @ 2001-01-30 22:20 UTC (permalink / raw)
  To: pgsql-sql

Saluton,

wouldn't it be a good idea (and if it is, I am not sure what list to
post it to) to have psql's option -f / --file take "-" for stdin, as
many programs do?

In shell scripts this would facilitate using here-documents:

cat <<ASDF | psql --set ON_ERROR_STOP= -f -
insert into a (b,c) valyooz ('Caesar's victory'::tekst, 'Backslash \');
ASDF

This way you could have the benefits of -f (e.g. line information in
error messages) without the need of external files; if you simply omit
"-f -" in the above example, you do not get the information that the
error occurred on line 1.

Albert.


P.S: BTW, the man page (7.0.2) of psql is not very clear: it took me
some experimentation to find out that you have to do "\set VARIABLE"
interactively or give "--set VARIABLE=" to set a variable that does
not take a value.

-- 

--------------------------------------------------------------------------
Albert Reiner                                   <areiner@tph.tuwien.ac.at>
Deutsch       *       English       *       Esperanto       *       Latine
--------------------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Suggestion for psql: --file -
@ 2001-02-02 15:16  Peter Eisentraut <peter_e@gmx.net>
  parent: Albert REINER <areiner@tph.tuwien.ac.at>
  0 siblings, 1 reply; 4+ messages in thread

From: Peter Eisentraut @ 2001-02-02 15:16 UTC (permalink / raw)
  To: Albert REINER <areiner@tph.tuwien.ac.at>; +Cc: pgsql-sql

Albert REINER writes:

> wouldn't it be a good idea (and if it is, I am not sure what list to
> post it to) to have psql's option -f / --file take "-" for stdin, as
> many programs do?

Seems reasonable.

> P.S: BTW, the man page (7.0.2) of psql is not very clear: it took me
> some experimentation to find out that you have to do "\set VARIABLE"
> interactively or give "--set VARIABLE=" to set a variable that does
> not take a value.

Suggested new wording?

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Suggestion for psql: --file -
@ 2001-02-02 19:30  Albert REINER <areiner@tph.tuwien.ac.at>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 4+ messages in thread

From: Albert REINER @ 2001-02-02 19:30 UTC (permalink / raw)
  To: pgsql-sql

On Fri, Feb 02, 2001 at 04:16:05PM +0100, Peter Eisentraut wrote:
> Albert REINER writes:
...
> > P.S: BTW, the man page (7.0.2) of psql is not very clear: it took me
> > some experimentation to find out that you have to do "\set VARIABLE"
> > interactively or give "--set VARIABLE=" to set a variable that does
> > not take a value.
> 
> Suggested new wording?

What about:

-v, --variable, --set variable[=[value]]

Performs a variable assignment, like the \set internal command.  Note
that you must separate name and value, if any, by an equal sign on the
command line. To unset a variable, leave off the equal sign and the
value.  To just set a variable without a value, use the equal sign but
leave off the value. These assignments are done during a very early
state of startup, so variables reserved for internal purposes might
get overwritten later.


Albert.

-- 

--------------------------------------------------------------------------
Albert Reiner                                   <areiner@tph.tuwien.ac.at>
Deutsch       *       English       *       Esperanto       *       Latine
--------------------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Suggestion for psql: --file -
@ 2001-02-03 19:18  Peter Eisentraut <peter_e@gmx.net>
  parent: Albert REINER <areiner@tph.tuwien.ac.at>
  0 siblings, 0 replies; 4+ messages in thread

From: Peter Eisentraut @ 2001-02-03 19:18 UTC (permalink / raw)
  To: Albert REINER <areiner@tph.tuwien.ac.at>; +Cc: pgsql-sql

Albert REINER writes:

> > Suggested new wording?
>
> What about:

Works for me.  Thanks.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2001-02-03 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-01-30 22:20 Suggestion for psql: --file - Albert REINER <areiner@tph.tuwien.ac.at>
2001-02-02 15:16 ` Peter Eisentraut <peter_e@gmx.net>
2001-02-02 19:30   ` Albert REINER <areiner@tph.tuwien.ac.at>
2001-02-03 19:18     ` Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox