BUG #4002: Error when I attemp to make a query by prompt

Started by Mario Plazasabout 18 years ago3 messagesbugs
Jump to latest
#1Mario Plazas
marioplazas@gmail.com

The following bug has been logged online:

Bug reference: 4002
Logged by: Mario Plazas
Email address: marioplazas@gmail.com
PostgreSQL version: 8.3.0
Operating system: win xp
Description: Error when I attemp to make a query by prompt
Details:

Hi.
In psql ver 8.3.0, I use a prompt line to connect and query a database. In
this line, I send the path for execute psql, database and user respectly
(the password are in a enviroment var); Then, I try to query, but the system
show the follow error:

C:\Archivos de programa\PostgreSQL\8.3\bin>"C:\Archivos de
programa\PostgreSQL\8
.3\bin\psql.exe" DBASE superpostgres -C "SELECT * FROM companies;"
psql: warning: extra command-line argument "-C" ignored
psql: warning: extra command-line argument "SELECT * FROM companies;"
ignored
Welcome to psql 8.3.0, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

DBASE=# \q

C:\Archivos de programa\PostgreSQL\8.3\bin>

It works fine on ver. 8.2.4-1 I think that this is a bug for the ver.
8.3.0-1 .

#2Bill Moran
wmoran@collaborativefusion.com
In reply to: Mario Plazas (#1)
Re: BUG #4002: Error when I attemp to make a query by prompt

In response to "Mario Plazas" <marioplazas@gmail.com>:

The following bug has been logged online:

Bug reference: 4002
Logged by: Mario Plazas
Email address: marioplazas@gmail.com
PostgreSQL version: 8.3.0
Operating system: win xp
Description: Error when I attemp to make a query by prompt
Details:

Hi.
In psql ver 8.3.0, I use a prompt line to connect and query a database. In
this line, I send the path for execute psql, database and user respectly
(the password are in a enviroment var); Then, I try to query, but the system
show the follow error:

C:\Archivos de programa\PostgreSQL\8.3\bin>"C:\Archivos de
programa\PostgreSQL\8
.3\bin\psql.exe" DBASE superpostgres -C "SELECT * FROM companies;"
psql: warning: extra command-line argument "-C" ignored
psql: warning: extra command-line argument "SELECT * FROM companies;"
ignored
Welcome to psql 8.3.0, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

DBASE=# \q

C:\Archivos de programa\PostgreSQL\8.3\bin>

It works fine on ver. 8.2.4-1 I think that this is a bug for the ver.
8.3.0-1 .

I believe the problem is that you want -c, not -C (case is important).

And it should fail on 8.2 as well, the documentation lists the option
as -c and a quick test here shows similar behaviour if I use -C on
8.2.

--
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bill Moran (#2)
Re: BUG #4002: Error when I attemp to make a query by prompt

Bill Moran <wmoran@collaborativefusion.com> writes:

In response to "Mario Plazas" <marioplazas@gmail.com>:

C:\Archivos de programa\PostgreSQL\8.3\bin>"C:\Archivos de
programa\PostgreSQL\8
.3\bin\psql.exe" DBASE superpostgres -C "SELECT * FROM companies;"
psql: warning: extra command-line argument "-C" ignored
psql: warning: extra command-line argument "SELECT * FROM companies;"
ignored

I believe the problem is that you want -c, not -C (case is important).

The other problem is that -c and its argument need to come *before* the
non-switch arguments (database and user name).

It works fine on ver. 8.2.4-1 I think that this is a bug for the ver.
8.3.0-1 .

It is not a bug. Some versions of getopt() happen to be laxer about
argument order than others, but we don't promise that the non-documented
order will work.

regards, tom lane