Re: Proposal: psql force prompting on notty

Started by Michael Maugerabout 22 years ago4 messages
#1Michael Mauger
mmaug@yahoo.com
--- Michael Mauger <mmaug@yahoo.com> wrote:
--- Peter Eisentraut <peter_e@gmx.net> wrote:

Michael Mauger writes:

Emacs is not a Cygwin (Un*x emulation on Windows) executable (like
psql is)

Why don't you use the native Windows version of psql?

The Cygwin setup program makes pre-built binaries of postgres
readily available on Windows. (In fact, using this version is
encouraged in the Postgres for Windows installation notes.) A
native Windows version would not work either since the isatty()
implementation there will only recognize a Command Prompt
window as a tty.

Are there further concerns with this patch?

--- pgsql-server/src/bin/psql/startup.c	29 Sep 2003 18:21:33 -0000	1.80
+++ pgsql-server/src/bin/psql/startup.c	01 Nov 2003 06:10:42 -0000
@@ -322,6 +322,7 @@
 		{"field-separator", required_argument, NULL, 'F'},
 		{"host", required_argument, NULL, 'h'},
 		{"html", no_argument, NULL, 'H'},
+		{"interactive", no_argument, NULL, 'I'},
 		{"list", no_argument, NULL, 'l'},
 		{"no-readline", no_argument, NULL, 'n'},
 		{"output", required_argument, NULL, 'o'},
@@ -352,7 +353,7 @@

memset(options, 0, sizeof *options);

-	while ((c = getopt_long(argc, argv,
"aAc:d:eEf:F:h:Hlno:p:P:qR:sStT:uU:v:VWxX?",
+	while ((c = getopt_long(argc, argv,
"aAc:d:eEf:F:h:HIlno:p:P:qR:sStT:uU:v:VWxX?",
 							long_options, &optindex)) != -1)
 	{
 		switch (c)
@@ -395,7 +396,10 @@
 			case 'H':
 				pset.popt.topt.format = PRINT_HTML;
 				break;
+			case 'I':
+				pset.notty = 0;
+				break;
 			case 'l':
 				options->action = ACT_LIST_DB;
 				break;
--- pgsql-server/src/bin/psql/help.c	02 Oct 2003 06:39:31 -0000	1.81
+++ pgsql-server/src/bin/psql/help.c	01 Nov 2003 06:29:50 -0000
@@ -103,6 +103,7 @@
 	puts(_("  -a              echo all input from script"));
 	puts(_("  -e              echo commands sent to server"));
 	puts(_("  -E              display queries that internal commands
generate"));
+	puts(_("  -I              force interactive prompting for input"));
 	puts(_("  -q              run quietly (no messages, only query
output)"));
 	puts(_("  -o FILENAME     send query results to file (or |pipe)"));
 	puts(_("  -n              disable enhanced command line editing
(readline)"));

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

#2Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Michael Mauger (#1)

No, just getting to it now. Sorry.

---------------------------------------------------------------------------

Michael Mauger wrote:

--- Michael Mauger <mmaug@yahoo.com> wrote:
--- Peter Eisentraut <peter_e@gmx.net> wrote:

Michael Mauger writes:

Emacs is not a Cygwin (Un*x emulation on Windows) executable (like
psql is)

Why don't you use the native Windows version of psql?

The Cygwin setup program makes pre-built binaries of postgres
readily available on Windows. (In fact, using this version is
encouraged in the Postgres for Windows installation notes.) A
native Windows version would not work either since the isatty()
implementation there will only recognize a Command Prompt
window as a tty.

Are there further concerns with this patch?

--- pgsql-server/src/bin/psql/startup.c	29 Sep 2003 18:21:33 -0000	1.80
+++ pgsql-server/src/bin/psql/startup.c	01 Nov 2003 06:10:42 -0000
@@ -322,6 +322,7 @@
{"field-separator", required_argument, NULL, 'F'},
{"host", required_argument, NULL, 'h'},
{"html", no_argument, NULL, 'H'},
+		{"interactive", no_argument, NULL, 'I'},
{"list", no_argument, NULL, 'l'},
{"no-readline", no_argument, NULL, 'n'},
{"output", required_argument, NULL, 'o'},
@@ -352,7 +353,7 @@

memset(options, 0, sizeof *options);

-	while ((c = getopt_long(argc, argv,
"aAc:d:eEf:F:h:Hlno:p:P:qR:sStT:uU:v:VWxX?",
+	while ((c = getopt_long(argc, argv,
"aAc:d:eEf:F:h:HIlno:p:P:qR:sStT:uU:v:VWxX?",
long_options, &optindex)) != -1)
{
switch (c)
@@ -395,7 +396,10 @@
case 'H':
pset.popt.topt.format = PRINT_HTML;
break;
+			case 'I':
+				pset.notty = 0;
+				break;
case 'l':
options->action = ACT_LIST_DB;
break;
--- pgsql-server/src/bin/psql/help.c	02 Oct 2003 06:39:31 -0000	1.81
+++ pgsql-server/src/bin/psql/help.c	01 Nov 2003 06:29:50 -0000
@@ -103,6 +103,7 @@
puts(_("  -a              echo all input from script"));
puts(_("  -e              echo commands sent to server"));
puts(_("  -E              display queries that internal commands
generate"));
+	puts(_("  -I              force interactive prompting for input"));
puts(_("  -q              run quietly (no messages, only query
output)"));
puts(_("  -o FILENAME     send query results to file (or |pipe)"));
puts(_("  -n              disable enhanced command line editing
(readline)"));

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Are there further concerns with this patch?

No, just getting to it now. Sorry.

Peter didn't agree with this patch, and I have to concur with him
that the need for it is unproven.

Given that it is certainly not going into 7.4 at this late date,
I think Michael will be wanting to look for another solution anyway...

regards, tom lane

#4Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Tom Lane (#3)

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Are there further concerns with this patch?

No, just getting to it now. Sorry.

Peter didn't agree with this patch, and I have to concur with him
that the need for it is unproven.

Given that it is certainly not going into 7.4 at this late date,
I think Michael will be wanting to look for another solution anyway...

Yea, certainly not 7.4. I am not sure he has any other ideas about a
solution, though. I will try to make him a test binary soon and see how
that works --- maybe we can make it an option that only shows up on
Win32.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073