IMHO the current behavior is broken:
decibel@decina:[17:46]~/pgsql/HEAD/i$bin/psql -c 'select 1' -c 'select 2'
I would expect psql to either run both commands or throw an error.
What I'd personally prefer is that psql execute -c and -f (and arguably -v) in
the order they're encountered, within the same session. I realize you can get
the same behavior by creating a .sql file, but for simple needs that's
sometimes more hassle than it's worth.
If we don't want to support that, we should throw an error if we encounter more
than one -c|-f. Not doing so allows for subtle, silent breakage.
Related to this, there's a bunch of other options that should only be allowed
once (ie: -d).
BTW, why do we special-case -? and -V at the top of main?
if (argc > 1)
if (strcmp(argv, "--help") == 0 || strcmp(argv, "-?") ==
if (strcmp(argv, "--version") == 0 || strcmp(argv, "-V")
Jim C. Nasby, Data Architect j...@nasby.net
512.569.9461 (cell) http://jim.nasby.net
Sent via pgsql-hackers mailing list (email@example.com)
To make changes to your subscription: