Re: [PATCHES] Patch to change psql default banner v6

2008-07-02 Thread Tom Lane
Guillaume Lelarge [EMAIL PROTECTED] writes:
 Attached is a new version of the patch. It fixes a few issues when one 
 adds a pattern to metacommands.

Applied with some editorialization.  There were some places you
evidently hadn't tested against all supported server versions ...

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-20 Thread Bryce Nesbitt

Guillaume Lelarge wrote:
Here is a patch that tries to implement this. Meta-commands should 
work from 7.4 to 8.4-devel releases. It was not hard to do, and I 
don't think it really is a burden to maintain.


One part left to fix is \du and \dg commands. I would be glad to 
continue to work on this but I would prefer to have comments before.
Good work!  I submitted a similar patch also. 

For your patch I have one critique: the version sensitive code is 
scattered all through describe.c.  Are there opportunities to apply some 
tests at a higher level (reducing the number of tests), or gather the 
tests into an easily maintainable chunk?


The cleaner it is, the more likely future patchers will continue to 
maintain compatibility.


 -Bryce Nesbitt


--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-20 Thread Guillaume Lelarge

Bryce Nesbitt a écrit :

Guillaume Lelarge wrote:
Here is a patch that tries to implement this. Meta-commands should 
work from 7.4 to 8.4-devel releases. It was not hard to do, and I 
don't think it really is a burden to maintain.


One part left to fix is \du and \dg commands. I would be glad to 
continue to work on this but I would prefer to have comments before.

Good work!  I submitted a similar patch also.


Yes, I've seen that.

For your patch I have one critique: the version sensitive code is 
scattered all through describe.c.  Are there opportunities to apply some 
tests at a higher level (reducing the number of tests), or gather the 
tests into an easily maintainable chunk?




I can't find an easy way to do this. And question is: is it really 
interesting to do this? I'm not sure it's worth it. If you want to work 
on this and patch my patch, you're welcome :)


The cleaner it is, the more likely future patchers will continue to 
maintain compatibility.




+1

Attached is a new version of the patch. It fixes a few issues when one 
adds a pattern to metacommands.


Regards.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
Index: src/bin/psql/describe.c
===
RCS file: /opt/cvsroot_postgresql/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.173
diff -c -c -r1.173 describe.c
*** src/bin/psql/describe.c	13 May 2008 00:23:17 -	1.173
--- src/bin/psql/describe.c	20 May 2008 19:33:27 -
***
*** 59,68 
  	 * There are two kinds of aggregates: ones that work on particular types
  	 * and ones that work on all (denoted by input type = any)
  	 */
  	printfPQExpBuffer(buf,
  	  SELECT n.nspname as \%s\,\n
  	p.proname AS \%s\,\n
! pg_catalog.format_type(p.prorettype, NULL) AS \%s\,\n
  	CASE WHEN p.pronargs = 0\n
  	  THEN CAST('*' AS pg_catalog.text)\n
  	  ELSE\n
--- 59,75 
  	 * There are two kinds of aggregates: ones that work on particular types
  	 * and ones that work on all (denoted by input type = any)
  	 */
+ 
  	printfPQExpBuffer(buf,
  	  SELECT n.nspname as \%s\,\n
  	p.proname AS \%s\,\n
! 	pg_catalog.format_type(p.prorettype, NULL) AS \%s\,
! 	  gettext_noop(Schema),
! 	  gettext_noop(Name),
! 	  gettext_noop(Result data type));
! 	
! 	if (pset.sversion = 80100)  
! 	appendPQExpBuffer(buf, ,\n
  	CASE WHEN p.pronargs = 0\n
  	  THEN CAST('*' AS pg_catalog.text)\n
  	  ELSE\n
***
*** 72,86 
  	FROM\n
  	  pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n
  	  ), ', ')\n
! 	END AS \%s\,\n
!    pg_catalog.obj_description(p.oid, 'pg_proc') as \%s\\n
  	  FROM pg_catalog.pg_proc p\n
  	LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n
  	  WHERE p.proisagg\n,
- 	  gettext_noop(Schema),
- 	  gettext_noop(Name),
- 	  gettext_noop(Result data type),
- 	  gettext_noop(Argument data types),
  	  gettext_noop(Description));
  
  	processSQLNamePattern(pset.db, buf, pattern, true, false,
--- 79,91 
  	FROM\n
  	  pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n
  	  ), ', ')\n
! 	END AS \%s\,
! 	  gettext_noop(Argument data types));
! 	  
! 	appendPQExpBuffer(buf, ,\n  pg_catalog.obj_description(p.oid, 'pg_proc') as \%s\\n
  	  FROM pg_catalog.pg_proc p\n
  	LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n
  	  WHERE p.proisagg\n,
  	  gettext_noop(Description));
  
  	processSQLNamePattern(pset.db, buf, pattern, true, false,
***
*** 132,142 
  	  gettext_noop(Location));
  
  	if (verbose)
  		appendPQExpBuffer(buf,
! 		  ,\n  spcacl AS \%s\
! 		 ,\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \%s\,
! 		  gettext_noop(Access privileges),
  		  gettext_noop(Description));
  
  	appendPQExpBuffer(buf,
  	  \nFROM pg_catalog.pg_tablespace\n);
--- 137,151 
  	  gettext_noop(Location));
  
  	if (verbose)
+ 	{
  		appendPQExpBuffer(buf,
! 		  ,\n  spcacl AS \%s\,
! 		  gettext_noop(Access privileges));
! if (pset.sversion = 80200)
! 		appendPQExpBuffer(buf,
!   ,\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \%s\,
  		  gettext_noop(Description));
+ }
  
  	appendPQExpBuffer(buf,
  	  \nFROM pg_catalog.pg_tablespace\n);
***
*** 179,186 
  	  SELECT n.nspname as \%s\,\n
  	p.proname as \%s\,\n
  	CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n
! pg_catalog.format_type(p.prorettype, NULL) as \%s\,\n
! 	CASE WHEN proallargtypes IS NOT NULL THEN\n
  	  pg_catalog.array_to_string(ARRAY(\n
  	SELECT\n
  	  CASE\n
--- 188,201 

Re: [PATCHES] Patch to change psql default banner v6

2008-05-19 Thread Guillaume Lelarge

Tom Lane a écrit :

Joshua D. Drake [EMAIL PROTECTED] writes:

Andrew Dunstan wrote:

Have at it then. Prove me wrong.


IMO the problem isn't the one off support for all supported version of 
Pg... say 7.4 - 8.4. The problem is of on going maintenance.



/me doesn't think it is worth the effort.


Since no one's done it yet, that would seem to be the consensus
opinion :-)

Still, it'd be interesting to see an attempt at making it go.
The costs of doing it now for existing versions would probably give us
a good idea of what the future maintenance effort might be like.
Without a real patch to look at, we're all just guessing about that.



Here is a patch that tries to implement this. Meta-commands should work 
from 7.4 to 8.4-devel releases. It was not hard to do, and I don't think 
it really is a burden to maintain.


One part left to fix is \du and \dg commands. I would be glad to 
continue to work on this but I would prefer to have comments before.


Thanks.

Regards.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
Index: describe.c
===
RCS file: /opt/cvsroot_postgresql/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.173
diff -c -c -r1.173 describe.c
*** describe.c	13 May 2008 00:23:17 -	1.173
--- describe.c	19 May 2008 17:19:28 -
***
*** 59,68 
  	 * There are two kinds of aggregates: ones that work on particular types
  	 * and ones that work on all (denoted by input type = any)
  	 */
  	printfPQExpBuffer(buf,
  	  SELECT n.nspname as \%s\,\n
  	p.proname AS \%s\,\n
! pg_catalog.format_type(p.prorettype, NULL) AS \%s\,\n
  	CASE WHEN p.pronargs = 0\n
  	  THEN CAST('*' AS pg_catalog.text)\n
  	  ELSE\n
--- 59,75 
  	 * There are two kinds of aggregates: ones that work on particular types
  	 * and ones that work on all (denoted by input type = any)
  	 */
+ 
  	printfPQExpBuffer(buf,
  	  SELECT n.nspname as \%s\,\n
  	p.proname AS \%s\,\n
! 	pg_catalog.format_type(p.prorettype, NULL) AS \%s\,
! 	  gettext_noop(Schema),
! 	  gettext_noop(Name),
! 	  gettext_noop(Result data type));
! 	
! 	if (pset.sversion = 80100)  
! 	appendPQExpBuffer(buf, ,\n
  	CASE WHEN p.pronargs = 0\n
  	  THEN CAST('*' AS pg_catalog.text)\n
  	  ELSE\n
***
*** 72,86 
  	FROM\n
  	  pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n
  	  ), ', ')\n
! 	END AS \%s\,\n
!    pg_catalog.obj_description(p.oid, 'pg_proc') as \%s\\n
  	  FROM pg_catalog.pg_proc p\n
  	LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n
  	  WHERE p.proisagg\n,
- 	  gettext_noop(Schema),
- 	  gettext_noop(Name),
- 	  gettext_noop(Result data type),
- 	  gettext_noop(Argument data types),
  	  gettext_noop(Description));
  
  	processSQLNamePattern(pset.db, buf, pattern, true, false,
--- 79,91 
  	FROM\n
  	  pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n
  	  ), ', ')\n
! 	END AS \%s\,
! 	  gettext_noop(Argument data types));
! 	  
! 	appendPQExpBuffer(buf, ,\n  pg_catalog.obj_description(p.oid, 'pg_proc') as \%s\\n
  	  FROM pg_catalog.pg_proc p\n
  	LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n
  	  WHERE p.proisagg\n,
  	  gettext_noop(Description));
  
  	processSQLNamePattern(pset.db, buf, pattern, true, false,
***
*** 132,142 
  	  gettext_noop(Location));
  
  	if (verbose)
  		appendPQExpBuffer(buf,
! 		  ,\n  spcacl AS \%s\
! 		 ,\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \%s\,
! 		  gettext_noop(Access privileges),
  		  gettext_noop(Description));
  
  	appendPQExpBuffer(buf,
  	  \nFROM pg_catalog.pg_tablespace\n);
--- 137,151 
  	  gettext_noop(Location));
  
  	if (verbose)
+ 	{
  		appendPQExpBuffer(buf,
! 		  ,\n  spcacl AS \%s\,
! 		  gettext_noop(Access privileges));
! if (pset.sversion = 80200)
! 		appendPQExpBuffer(buf,
!   ,\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \%s\,
  		  gettext_noop(Description));
+ }
  
  	appendPQExpBuffer(buf,
  	  \nFROM pg_catalog.pg_tablespace\n);
***
*** 179,186 
  	  SELECT n.nspname as \%s\,\n
  	p.proname as \%s\,\n
  	CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n
! pg_catalog.format_type(p.prorettype, NULL) as \%s\,\n
! 	CASE WHEN proallargtypes IS NOT NULL THEN\n
  	  pg_catalog.array_to_string(ARRAY(\n
  	SELECT\n
  	  CASE\n
--- 188,201 
  	  SELECT n.nspname as \%s\,\n
  	p.proname as \%s\,\n
  	CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n
! 

Re: [PATCHES] Patch to change psql default banner v6

2008-05-16 Thread David Fetter
On Fri, May 16, 2008 at 01:22:55AM -0400, Tom Lane wrote:
 David Fetter [EMAIL PROTECTED] writes:
  I believe there's a bug in this patch, namely that the warnings when
  there's a server-client mismatch only appear at startup time.
 
 Please do not blame this patch for a problem that has been there all
 along.
 
 I don't say that the point doesn't need investigation, but blaming
 the patch-at-hand for the issue is just misleading.

The patch at hand, as you point out, emphasizes a problem that's been
there all along, namely that \c doesn't do the same things that
command line connection does.

I'm volunteering to make them use the same methods :)

Cheers,
David.
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-16 Thread Tom Lane
David Fetter [EMAIL PROTECTED] writes:
 I believe there's a bug in this patch, namely that the warnings when
 there's a server-client mismatch only appear at startup time.

Please do not blame this patch for a problem that has been there all
along.

I don't say that the point doesn't need investigation, but blaming
the patch-at-hand for the issue is just misleading.

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-16 Thread David Fetter
On Thu, May 15, 2008 at 03:21:37PM -0400, Bruce Momjian wrote:
 Alvaro Herrera wrote:
  
  I'm OK with thisG but please move the printSSLInfo() call just before
  echoing the help line.
 
 Oh, good catch, moved.  I also moved the Win32 code page message up too.
 Patch attached.
 
 I hacked up an example that shows both SSL and Win32 code page messages:

I believe there's a bug in this patch, namely that the warnings when
there's a server-client mismatch only appear at startup time.  This is
a pretty clear POLA violation, IMHO.

On my laptop, I have two pg instances running: 8.3.0 on port 5432, CVS
TIP on 2225.

Here's what I get if I invoke psql from the command line:

$ psql -p 5432 postgres
Welcome to psql 8.4devel (server 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

WARNING:  You are connected to a server with major version 8.3,
but your psql client is major version 8.4.  Some backslash commands,
such as \d, might not work properly.

Here's what I get if I use \c, having connected to CVS TIP first:

[EMAIL PROTECTED] \c - - - 5432
You are now connected to database postgres at port 5432.

I think that the warning should be consistently there on connect
instead of just at program start.

Not coincidentally, moving all the checks into one spot, i.e. making
startup.c and command.c call and test the same things to connect to a
database, advances my Evil Plan™ to make more interesting things
happen when switching versions :)

Cheers,
David.
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-16 Thread Bruce Momjian
Bruce Momjian wrote:
 OK, here is the mega-print:
 
   $ psql test
   psql (8.4devel, server 8.4devel)
   WARNING: psql version 8.4, server version 8.4.
Some psql features might not work.
   WARNING: Console code page (44) differs from Windows code page (55)
8-bit characters might not work correctly. See psql reference
page Notes for Windows users for details.
   SSL connection (cipher: 55, bits: 512)
   Type help for help.
   
   test=
 

Updated patch applied, docs adjusted for new psql startup banner.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/start.sgml
===
RCS file: /cvsroot/pgsql/doc/src/sgml/start.sgml,v
retrieving revision 1.46
diff -c -c -r1.46 start.sgml
*** doc/src/sgml/start.sgml	23 Jan 2008 02:04:47 -	1.46
--- doc/src/sgml/start.sgml	16 May 2008 17:06:38 -
***
*** 329,341 
  In commandpsql/command, you will be greeted with the following
  message:
  screen
! Welcome to psql version;, 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
   
  mydb=gt;
  /screen
--- 329,336 
  In commandpsql/command, you will be greeted with the following
  message:
  screen
! psql (version;)
! Type help for help.
   
  mydb=gt;
  /screen
Index: doc/src/sgml/ref/psql-ref.sgml
===
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.205
diff -c -c -r1.205 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml	16 May 2008 16:59:05 -	1.205
--- doc/src/sgml/ref/psql-ref.sgml	16 May 2008 17:06:38 -
***
*** 571,583 
  the string literal=gt;/literal. For example:
  programlisting
  $ userinputpsql testdb/userinput
! Welcome to psql version;, 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
  
  testdb=gt;
  /programlisting
--- 571,580 
  the string literal=gt;/literal. For example:
  programlisting
  $ userinputpsql testdb/userinput
! psql (version;)
! Type help for help.
  
! test=
  
  testdb=gt;
  /programlisting
Index: src/bin/psql/help.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.127
diff -c -c -r1.127 help.c
*** src/bin/psql/help.c	14 May 2008 15:30:22 -	1.127
--- src/bin/psql/help.c	16 May 2008 17:06:39 -
***
*** 170,182 
  	 */
  	fprintf(output, _(General\n));
  	fprintf(output, _(  \\copyright show PostgreSQL usage and distribution terms\n));
  	fprintf(output, _(  \\h [NAME]  help on syntax of SQL commands, * for all commands\n));
  	fprintf(output, _(  \\q quit psql\n));
  	fprintf(output, \n);
  
  	fprintf(output, _(Query Buffer\n));
  	fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) with external editor\n));
- 	fprintf(output, _(  \\g [FILE]  send query buffer to server (and results to file or |pipe)\n));
  	fprintf(output, _(  \\p show the contents of the query buffer\n));
  	fprintf(output, _(  \\r reset (clear) the query buffer\n));
  #ifdef USE_READLINE
--- 170,182 
  	 */
  	fprintf(output, _(General\n));
  	fprintf(output, _(  \\copyright show PostgreSQL usage and distribution terms\n));
+ 	fprintf(output, _(  \\g [FILE] or ; execute query (and send results to file or |pipe)\n));
  	fprintf(output, _(  \\h [NAME]  help on syntax of SQL commands, * for all commands\n));
  	fprintf(output, _(  \\q quit psql\n));
  	fprintf(output, \n);
  
  	fprintf(output, _(Query Buffer\n));
  	fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) with external editor\n));
  	fprintf(output, _(  \\p show the contents of the query buffer\n));
  	fprintf(output, _(  \\r reset (clear) the query buffer\n));
  #ifdef USE_READLINE
Index: src/bin/psql/mainloop.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.90
diff -c -c -r1.90 mainloop.c
*** src/bin/psql/mainloop.c	5 Apr 2008 03:40:15 -	1.90
--- src/bin/psql/mainloop.c	16 May 2008 17:06:39 -
***
*** 177,186 
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_(You are using psql, the command-line interface to 

Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes:
 Ah, OK.  I had forgotten.  Here is the new output:

   $ sql test
   psql (8.4devel)   Type help for help.

   test= help

You are being unreasonably cryptic here.  What happens when there
is optional output --- ie, version mismatch warning and/or SSL info?

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian [EMAIL PROTECTED] writes:
  Ah, OK.  I had forgotten.  Here is the new output:
 
  $ sql test
  psql (8.4devel)   Type help for help.
   
  test= help
 
 You are being unreasonably cryptic here.  What happens when there
 is optional output --- ie, version mismatch warning and/or SSL info?

Oh, good point.  Let me look at that.  Thanks.  You prefer:

$ sql test
psql (8.4devel)
Type help for help.

test= help

That looked so sparse to me.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes:
 Oh, good point.  Let me look at that.  Thanks.  You prefer:

   $ sql test
   psql (8.4devel)
   Type help for help.

   test= help

Well, the question is still where is the optional info going to go?

I think what I'd find nice looking is

$ psql test
psql 8.4devel  [ server version warning here, if needed ]
[ line with SSL info here, if needed ]
Type help for help.

test= 

I do feel that the help statement ought to be on its own line;
the other way is going to look cluttered, particularly as soon
as there's a version warning in there.

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Joshua D. Drake

Tom Lane wrote:


Well, the question is still where is the optional info going to go?

I think what I'd find nice looking is

$ psql test
psql 8.4devel  [ server version warning here, if needed ]
[ line with SSL info here, if needed ]
Type help for help.

	test= 


I do feel that the help statement ought to be on its own line;
the other way is going to look cluttered, particularly as soon
as there's a version warning in there.


O.k. I am not trying to start an argument here but... I already sent 6 
revisions of this patch that received comments and had thorough review 
via Alvaro. I even took into account Tom's original comments from the 
previous thread.


This much effort on something so simple makes it not worth the effort in 
the first place.


Bruce with respect the only useful thing I have seen you do to the patch 
in all this wrangling is realign the \? General options and frankly even 
that is suspect in my opinion. Can we either throw it away and say, 
Nice try JD or just commit the thing.


Joshua D. Drake




regards, tom lane




--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Bruce Momjian
Joshua D. Drake wrote:
 O.k. I am not trying to start an argument here but... I already sent 6 
 revisions of this patch that received comments and had thorough review 
 via Alvaro. I even took into account Tom's original comments from the 
 previous thread.
 
 This much effort on something so simple makes it not worth the effort in 
 the first place.
 
 Bruce with respect the only useful thing I have seen you do to the patch 
 in all this wrangling is realign the \? General options and frankly even 
 that is suspect in my opinion. Can we either throw it away and say, 
 Nice try JD or just commit the thing.

Your patch is getting the same review any other patch would have.  If
you want someone else to apply it I will stop working on it.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Andrew Dunstan



Joshua D. Drake wrote:


O.k. I am not trying to start an argument here but... I already sent 6 
revisions of this patch that received comments and had thorough review 
via Alvaro. I even took into account Tom's original comments from the 
previous thread.


This much effort on something so simple makes it not worth the effort 
in the first place.





Welcome to UI development. There is always *far* more argument of minor 
matters of appearance than over anything else, in my experience.


cheers

andrew

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Joshua D. Drake
On Thu, 15 May 2008 11:46:41 -0400 (EDT)
Bruce Momjian [EMAIL PROTECTED] wrote:

  Bruce with respect the only useful thing I have seen you do to the
  patch in all this wrangling is realign the \? General options and
  frankly even that is suspect in my opinion. Can we either throw it
  away and say, Nice try JD or just commit the thing.
 
 Your patch is getting the same review any other patch would have.  If
 you want someone else to apply it I will stop working on it.

I am not asking you to not review the patch. I am asking you to be
productive in doing so.  Your review of this patch is basically, Even
though there were two very long threads with several (on the greater
side of several) different people contributing feedback, I think I know
better.

That behavior is frustrating, especially when I took an extreme amount
of effort to address all concerns ahead of the actual commit fest. I
wanted to make sure the patch would be easy to review and easy to
commit. If I thought I was going to have to have the argument all over
again, I just would have left the first submission as it was and then
we could have burned all the time during commit fest only.

Now Alvaro, Tom and I are all having the same discussion all over again
but this time with Bruce. It makes no sense.

Sincerely,

Joshua D. Drake

-- 
The PostgreSQL Company since 1997: http://www.commandprompt.com/ 
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate




signature.asc
Description: PGP signature


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Alvaro Herrera
Andrew Dunstan wrote:

 Welcome to UI development. There is always *far* more argument of minor  
 matters of appearance than over anything else, in my experience.

Which is a good thing (in this case at least), because otherwise we
would end up with a crappy UI just because a single person thinks it's
good enough.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian [EMAIL PROTECTED] writes:
  Oh, good point.  Let me look at that.  Thanks.  You prefer:
 
  $ sql test
  psql (8.4devel)
  Type help for help.
 
  test= help
 
 Well, the question is still where is the optional info going to go?
 
 I think what I'd find nice looking is
 
   $ psql test
   psql 8.4devel  [ server version warning here, if needed ]
   [ line with SSL info here, if needed ]
   Type help for help.
 
   test= 
 
 I do feel that the help statement ought to be on its own line;
 the other way is going to look cluttered, particularly as soon
 as there's a version warning in there.

OK, here is the normal startup now:

$ sql test
psql (8.4.0)
Type help for help.

test=

Here is a minor version mismatch:

$ sql test
psql (8.4.0, server 8.4.1)
Type help for help.

test=

Here is a major version mismatch:

$ sql test
psql (8.4.0, server 8.3.1)
WARNING: psql version 8.4.0, server version 8.3.1.
Some psql features might not work.
Type help for help.

test=

I have also added '\g' to the 'help' display:

test= help

You are using psql, the command-line interface to PostgreSQL.
\? for psql help
\h or \help for SQL help

\g or ; to execute a query
\q to quit psql

\copyright to view the copyright

test=

I don't know how to generate an SSL message.

With the new smaller \? General section, I though it was worth
considering if we still want to do the help banner the same.  Obviously
we do, but I wanted to explore it.

Patch attached.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/bin/psql/help.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.127
diff -c -c -r1.127 help.c
*** src/bin/psql/help.c 14 May 2008 15:30:22 -  1.127
--- src/bin/psql/help.c 15 May 2008 16:05:51 -
***
*** 170,182 
 */
fprintf(output, _(General\n));
fprintf(output, _(  \\copyright show PostgreSQL usage and 
distribution terms\n));
fprintf(output, _(  \\h [NAME]  help on syntax of SQL commands, * 
for all commands\n));
fprintf(output, _(  \\q quit psql\n));
fprintf(output, \n);
  
fprintf(output, _(Query Buffer\n));
fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) 
with external editor\n));
-   fprintf(output, _(  \\g [FILE]  send query buffer to server (and 
results to file or |pipe)\n));
fprintf(output, _(  \\p show the contents of the query 
buffer\n));
fprintf(output, _(  \\r reset (clear) the query 
buffer\n));
  #ifdef USE_READLINE
--- 170,182 
 */
fprintf(output, _(General\n));
fprintf(output, _(  \\copyright show PostgreSQL usage and 
distribution terms\n));
+   fprintf(output, _(  \\g [FILE] or ; execute query (and send results to 
file or |pipe)\n));
fprintf(output, _(  \\h [NAME]  help on syntax of SQL commands, * 
for all commands\n));
fprintf(output, _(  \\q quit psql\n));
fprintf(output, \n);
  
fprintf(output, _(Query Buffer\n));
fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) 
with external editor\n));
fprintf(output, _(  \\p show the contents of the query 
buffer\n));
fprintf(output, _(  \\r reset (clear) the query 
buffer\n));
  #ifdef USE_READLINE
Index: src/bin/psql/mainloop.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.90
diff -c -c -r1.90 mainloop.c
*** src/bin/psql/mainloop.c 5 Apr 2008 03:40:15 -   1.90
--- src/bin/psql/mainloop.c 15 May 2008 16:05:51 -
***
*** 177,186 
(line[4] == '\0' || line[4] == ';' || isspace((unsigned 
char) line[4])))
{
free(line);
!   puts(_(You are using psql, the command-line interface 
to PostgreSQL.));
!   puts(_(Enter SQL commands, or type \\? for a list of 
backslash options.));
!   puts(_(Use \\h for SQL command help.));
!   puts(_(Use \\q to quit.));
fflush(stdout);
continue;
}
--- 177,189 
(line[4] == '\0' || line[4] == ';' || isspace((unsigned 
char) line[4])))
{
 

Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Ron Mayer

Alvaro Herrera wrote:

Andrew Dunstan wrote:

Welcome to UI development. There is always *far* more argument of minor  
matters of appearance than over anything else, in my experience.


Which is a good thing (in this case at least), because otherwise we
would end up with a crappy UI just because a single person thinks it's
good enough.



This makes me think we shouldn't be hard-coding anything at all
as the welcome message; but rather having a default .psqlrc
in much the same way that that there's a default /etc/bash.bashrc
and /etc/csh.login.

Within that default .psqlrc we can put
   \qecho Whatever the default message is
or
   select my message +version();
to create the default, but then anyone with their own .psqlrc
can re-define it to whatever they think is a good enough UI.


--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Bruce Momjian
Ron Mayer wrote:
 Alvaro Herrera wrote:
  Andrew Dunstan wrote:
  
  Welcome to UI development. There is always *far* more argument of minor  
  matters of appearance than over anything else, in my experience.
  
  Which is a good thing (in this case at least), because otherwise we
  would end up with a crappy UI just because a single person thinks it's
  good enough.
 
 
 This makes me think we shouldn't be hard-coding anything at all
 as the welcome message; but rather having a default .psqlrc
 in much the same way that that there's a default /etc/bash.bashrc
 and /etc/csh.login.
 
 Within that default .psqlrc we can put
 \qecho Whatever the default message is
 or
 select my message +version();
 to create the default, but then anyone with their own .psqlrc
 can re-define it to whatever they think is a good enough UI.

We could do that but we still have to design the default banner.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes:
 Ron Mayer wrote:
 This makes me think we shouldn't be hard-coding anything at all
 as the welcome message; but rather having a default .psqlrc
 in much the same way that that there's a default /etc/bash.bashrc
 and /etc/csh.login.
 
 Within that default .psqlrc we can put
 \qecho Whatever the default message is
 or
 select my message +version();
 to create the default, but then anyone with their own .psqlrc
 can re-define it to whatever they think is a good enough UI.

 We could do that but we still have to design the default banner.

More to the point, we would then have to design API with which a
custom .psqlrc could put out information about psql version,
server version, SSL status, etc.  It would take a lot of work
to make this approach actually useful, and there isn't demand
to justify it AFAIK.

It's worth polishing the default behavior in any case, because
that is what newbies are going to see.

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Alvaro Herrera

I'm OK with thisG but please move the printSSLInfo() call just before
echoing the help line.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Bruce Momjian
Alvaro Herrera wrote:
 
 I'm OK with thisG but please move the printSSLInfo() call just before
 echoing the help line.

Oh, good catch, moved.  I also moved the Win32 code page message up too.
Patch attached.

I hacked up an example that shows both SSL and Win32 code page messages:

$ psql test
psql (8.4devel)
SSL connection (cipher: 2343, bits: 512)
WARNING: Console code page (323) differs from Windows code page 
(2323)
 8-bit characters might not work correctly. See psql 
reference
 page Notes for Windows users for details.
Type help for help.

test=

With major version mismatches it looks like this:

$ psql test
psql (8.4devel)
SSL connection (cipher: 2343, bits: 512)
WARNING: Console code page (323) differs from Windows code page 
(2323)
 8-bit characters might not work correctly. See psql 
reference
 page Notes for Windows users for details.
WARNING: psql version 8.4.0, server version 8.3.1.
 Some psql features might not work.
Type help for help.

test=

By indenting those messages the 'help' message still stands out. 
Adjustments?

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/bin/psql/help.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.127
diff -c -c -r1.127 help.c
*** src/bin/psql/help.c	14 May 2008 15:30:22 -	1.127
--- src/bin/psql/help.c	15 May 2008 19:17:27 -
***
*** 170,182 
  	 */
  	fprintf(output, _(General\n));
  	fprintf(output, _(  \\copyright show PostgreSQL usage and distribution terms\n));
  	fprintf(output, _(  \\h [NAME]  help on syntax of SQL commands, * for all commands\n));
  	fprintf(output, _(  \\q quit psql\n));
  	fprintf(output, \n);
  
  	fprintf(output, _(Query Buffer\n));
  	fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) with external editor\n));
- 	fprintf(output, _(  \\g [FILE]  send query buffer to server (and results to file or |pipe)\n));
  	fprintf(output, _(  \\p show the contents of the query buffer\n));
  	fprintf(output, _(  \\r reset (clear) the query buffer\n));
  #ifdef USE_READLINE
--- 170,182 
  	 */
  	fprintf(output, _(General\n));
  	fprintf(output, _(  \\copyright show PostgreSQL usage and distribution terms\n));
+ 	fprintf(output, _(  \\g [FILE] or ; execute query (and send results to file or |pipe)\n));
  	fprintf(output, _(  \\h [NAME]  help on syntax of SQL commands, * for all commands\n));
  	fprintf(output, _(  \\q quit psql\n));
  	fprintf(output, \n);
  
  	fprintf(output, _(Query Buffer\n));
  	fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) with external editor\n));
  	fprintf(output, _(  \\p show the contents of the query buffer\n));
  	fprintf(output, _(  \\r reset (clear) the query buffer\n));
  #ifdef USE_READLINE
Index: src/bin/psql/mainloop.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.90
diff -c -c -r1.90 mainloop.c
*** src/bin/psql/mainloop.c	5 Apr 2008 03:40:15 -	1.90
--- src/bin/psql/mainloop.c	15 May 2008 19:17:27 -
***
*** 177,186 
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_(You are using psql, the command-line interface to PostgreSQL.));
! 			puts(_(Enter SQL commands, or type \\? for a list of backslash options.));
! 			puts(_(Use \\h for SQL command help.));
! 			puts(_(Use \\q to quit.));
  			fflush(stdout);
  			continue;
  		}
--- 177,189 
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_(\nYou are using psql, the command-line interface to PostgreSQL.));
! 			puts(_(\t\\? for psql help));
! 			puts(_(\t\\h or \\help for SQL help\n));
! 			puts(_(\t\\g or \;\ to execute a query));
! 			puts(_(\t\\q to quit psql\n));
! 			puts(_(\t\\copyright to view the copyright\n));
! 
  			fflush(stdout);
  			continue;
  		}
Index: src/bin/psql/startup.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.147
diff -c -c -r1.147 startup.c
*** src/bin/psql/startup.c	8 May 2008 17:04:26 -	1.147
--- src/bin/psql/startup.c	15 May 2008 19:17:27 -
***
*** 300,305 
--- 300,312 
  		{
  			int			client_ver = parse_version(PG_VERSION);
  
+ #ifdef USE_SSL
+ 			printSSLInfo();
+ #endif
+ #ifdef WIN32
+ 		

Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes:
 With major version mismatches it looks like this:

   $ psql test
   psql (8.4devel)
   SSL connection (cipher: 2343, bits: 512)
   WARNING: Console code page (323) differs from Windows code page 
 (2323)
8-bit characters might not work correctly. See psql 
 reference
page Notes for Windows users for details.
   WARNING: psql version 8.4.0, server version 8.3.1.
Some psql features might not work.
   Type help for help.

 By indenting those messages the 'help' message still stands out. 

My advice: don't do that, it just looks weird.  Both of these look
fine to me:

$ psql test
psql (8.4devel)
SSL connection (cipher: 2343, bits: 512)
Type help for help.

$ psql test
psql (8.4devel)
SSL connection (cipher: 2343, bits: 512)
WARNING: Console code page (323) differs from Windows code page (2323)
 8-bit characters might not work correctly. See psql reference
 page Notes for Windows users for details.
WARNING: psql version 8.4.0, server version 8.3.1.
 Some psql features might not work.
Type help for help.

Also, maybe it's just me, but I think you have put the order of these
optional things exactly backwards.  I'd do

$ psql test
psql (8.4devel)
WARNING: psql version 8.4.0, server version 8.3.1.
 Some psql features might not work.
WARNING: Console code page (323) differs from Windows code page (2323)
 8-bit characters might not work correctly. See psql reference
 page Notes for Windows users for details.
SSL connection (cipher: 2343, bits: 512)
Type help for help.

Why?  Well, it's just more nearly the way it used to be.

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian [EMAIL PROTECTED] writes:
  With major version mismatches it looks like this:
 
  $ psql test
  psql (8.4devel)
  SSL connection (cipher: 2343, bits: 512)
  WARNING: Console code page (323) differs from Windows code page 
  (2323)
   8-bit characters might not work correctly. See psql 
  reference
   page Notes for Windows users for details.
  WARNING: psql version 8.4.0, server version 8.3.1.
   Some psql features might not work.
  Type help for help.
 
  By indenting those messages the 'help' message still stands out. 
 
 My advice: don't do that, it just looks weird.  Both of these look
 fine to me:
 
 $ psql test
 psql (8.4devel)
 SSL connection (cipher: 2343, bits: 512)
 Type help for help.
 
 $ psql test
 psql (8.4devel)
 SSL connection (cipher: 2343, bits: 512)
 WARNING: Console code page (323) differs from Windows code page (2323)
  8-bit characters might not work correctly. See psql reference
  page Notes for Windows users for details.
 WARNING: psql version 8.4.0, server version 8.3.1.
  Some psql features might not work.
 Type help for help.
 
 Also, maybe it's just me, but I think you have put the order of these
 optional things exactly backwards.  I'd do
 
 $ psql test
 psql (8.4devel)
 WARNING: psql version 8.4.0, server version 8.3.1.
  Some psql features might not work.
 WARNING: Console code page (323) differs from Windows code page (2323)
  8-bit characters might not work correctly. See psql reference
  page Notes for Windows users for details.
 SSL connection (cipher: 2343, bits: 512)
 Type help for help.
 
 Why?  Well, it's just more nearly the way it used to be.

OK, here is the mega-print:

$ psql test
psql (8.4devel, server 8.4devel)
WARNING: psql version 8.4, server version 8.4.
 Some psql features might not work.
WARNING: Console code page (44) differs from Windows code page (55)
 8-bit characters might not work correctly. See psql reference
 page Notes for Windows users for details.
SSL connection (cipher: 55, bits: 512)
Type help for help.

test=

Patch at ftp://momjian.us/pub/postgresql/mypatches/help.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread daveg
On Thu, May 15, 2008 at 10:20:53AM -0700, Ron Mayer wrote:
 Alvaro Herrera wrote:
 Andrew Dunstan wrote:
 
 Welcome to UI development. There is always *far* more argument of minor  
 matters of appearance than over anything else, in my experience.
 
 Which is a good thing (in this case at least), because otherwise we
 would end up with a crappy UI just because a single person thinks it's
 good enough.
 
 
 This makes me think we shouldn't be hard-coding anything at all
 as the welcome message; but rather having a default .psqlrc
 in much the same way that that there's a default /etc/bash.bashrc
 and /etc/csh.login.
 
 Within that default .psqlrc we can put
\qecho Whatever the default message is
 or
select my message +version();
 to create the default, but then anyone with their own .psqlrc
 can re-define it to whatever they think is a good enough UI.

+1
Including no banner at all please.
 

-- 
David Gould   [EMAIL PROTECTED]  510 536 1443510 282 0869
If simplicity worked, the world would be overrun with insects.

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Bruce Momjian
daveg wrote:
 On Thu, May 15, 2008 at 10:20:53AM -0700, Ron Mayer wrote:
  Alvaro Herrera wrote:
  Andrew Dunstan wrote:
  
  Welcome to UI development. There is always *far* more argument of minor  
  matters of appearance than over anything else, in my experience.
  
  Which is a good thing (in this case at least), because otherwise we
  would end up with a crappy UI just because a single person thinks it's
  good enough.
  
  
  This makes me think we shouldn't be hard-coding anything at all
  as the welcome message; but rather having a default .psqlrc
  in much the same way that that there's a default /etc/bash.bashrc
  and /etc/csh.login.
  
  Within that default .psqlrc we can put
 \qecho Whatever the default message is
  or
 select my message +version();
  to create the default, but then anyone with their own .psqlrc
  can re-define it to whatever they think is a good enough UI.
 
 +1
 Including no banner at all please.

There is a psql quiet option that shows no banner:

   -q
   --quiet
  Specifies  that psql should do its work quietly. By
  default, it prints  welcome  messages  and  various
  informational  output. If this option is used, none
  of this happens. This is useful with the -c option.
  Within  psql you can also set the QUIET variable to
  achieve the same effect.

You could then use \echo in .psqlrc to make your own banner.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread David Fetter
On Thu, May 15, 2008 at 12:09:25PM -0400, Alvaro Herrera wrote:
 Andrew Dunstan wrote:
 
  Welcome to UI development. There is always *far* more argument of minor  
  matters of appearance than over anything else, in my experience.
 
 Which is a good thing (in this case at least), because otherwise we
 would end up with a crappy UI just because a single person thinks it's
 good enough.

I hate to bike-shed this even further, but I'd like to make those
incompatibility messages just go away by making 8.4's psql (and all
those going forward) support every living version of Postgres at the
time of their release, so 8.4's psql would be able to talk seamlessly
to Postgres 7.4 :)

Cheers,
David (well, not really bike-shedding, but trying to propose a feature
that reduces the amount of UI clutter)
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Gregory Stark
Alvaro Herrera [EMAIL PROTECTED] writes:

 Bruce Momjian wrote:

 I know we decided not to do that, but I am trying to figure out what the
 goal if 'help' is?  To display the most frequently-used help commands? 
 Aren't they at the top of \?.

 The purpose of 'help' is to provide useful help.  If it only says see \?
 then it's just redirecting you somewhere else, which isn't useful.

Haven't been following this thread. Has the idea of making help just a
synonym for \? not come up? Or has it been rejected? It seems simplest.


-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Andrew Dunstan



David Fetter wrote:


I hate to bike-shed this even further, but I'd like to make those
incompatibility messages just go away by making 8.4's psql (and all
those going forward) support every living version of Postgres at the
time of their release, so 8.4's psql would be able to talk seamlessly
to Postgres 7.4 :)

  


I think you must have been out in the sun too long.

Just look at the pg_dump code if you want something of an idea of what 
this would involve.


cheers

andrew

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Tom Lane
Andrew Dunstan [EMAIL PROTECTED] writes:
 David Fetter wrote:
 I hate to bike-shed this even further, but I'd like to make those
 incompatibility messages just go away by making 8.4's psql (and all
 those going forward) support every living version of Postgres at the
 time of their release,

 I think you must have been out in the sun too long.

Hey, he's welcome to try to do it.  But it's utterly unrelated to the
patch at hand, and we are not holding up the patch at hand until
something like that happens.

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread David Fetter
On Thu, May 15, 2008 at 06:55:31PM -0400, Andrew Dunstan wrote:
 David Fetter wrote:

 I hate to bike-shed this even further, but I'd like to make those
 incompatibility messages just go away by making 8.4's psql (and
 all those going forward) support every living version of Postgres
 at the time of their release, so 8.4's psql would be able to talk
 seamlessly to Postgres 7.4 :)

 I think you must have been out in the sun too long.

One thing I really treasure about working on the Postgres project is
frank feedback. :)

 Just look at the pg_dump code if you want something of an idea of
 what this would involve.

Given that each previous version tied backslash commands to some
particular chunk of SQL, what would be the problem with either
immediately or lazily setting those to the chunks of SQL already
present in previous versions?

Cheers,
David.
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread David Fetter
On Thu, May 15, 2008 at 06:57:12PM -0400, Tom Lane wrote:
 Andrew Dunstan [EMAIL PROTECTED] writes:
  David Fetter wrote:
  I hate to bike-shed this even further, but I'd like to make those
  incompatibility messages just go away by making 8.4's psql (and
  all those going forward) support every living version of Postgres
  at the time of their release,
 
  I think you must have been out in the sun too long.
 
 Hey, he's welcome to try to do it.  But it's utterly unrelated to
 the patch at hand, and we are not holding up the patch at hand until
 something like that happens.

Nor am I suggesting holding up this patch for that reason :)

Cheers,
David.
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Andrew Dunstan



David Fetter wrote:

On Thu, May 15, 2008 at 06:55:31PM -0400, Andrew Dunstan wrote:
  

David Fetter wrote:


I hate to bike-shed this even further, but I'd like to make those
incompatibility messages just go away by making 8.4's psql (and
all those going forward) support every living version of Postgres
at the time of their release, so 8.4's psql would be able to talk
seamlessly to Postgres 7.4 :)
  

I think you must have been out in the sun too long.



One thing I really treasure about working on the Postgres project is
frank feedback. :)
  


I know you know me well enough to realise there was an implied smiley ;-)

  

Just look at the pg_dump code if you want something of an idea of
what this would involve.



Given that each previous version tied backslash commands to some
particular chunk of SQL, what would be the problem with either
immediately or lazily setting those to the chunks of SQL already
present in previous versions?


  


First, this is not a cost free exercise - it increases code complexity 
enormously.


Second, it's not nearly as easy as that:
. new commands have been added
. postgres features have been added
. catalogs have changed

Among other things, help and indeed the available command set would have 
to become server version sensitive.


And you would greatly increase the bar for anyone wanting to add a new 
command - now they (or someone) would have to work out how the command 
would or might work n versions back, not just with the current dev version.


Doing it lazily isn't acceptable - if we promise \command compatibility 
with previous server versions then we need to deliver it to the maximum 
extent possible, and if we don't promise it there's no point in doing this.


And, as Tom says, it has nothing really to do with this patch.

cheers

andrew



--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Alvaro Herrera
Andrew Dunstan wrote:

 Second, it's not nearly as easy as that:
 . new commands have been added
 . postgres features have been added
 . catalogs have changed

Well, this just means a different piece of SQL needs to be sent for a
command depending on the server version, right?  It's not like that's
tremendously different.  The nice thing about most \X commands is that
they embed everything they need in a bunch of SQL, and they don't need
much else in C code.  So it's not all that difficult.

And for commands that have been added later, an initial version could
just say this server version does not support this command.  It would
be already a huge improvement.

Probably the biggest change would be to support versions that did not
have schemas, but I think it would be OK to punt on that.  We already
stopped supporting 7.2 anyway.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Andrew Dunstan



Alvaro Herrera wrote:

Andrew Dunstan wrote:

  

Second, it's not nearly as easy as that:
. new commands have been added
. postgres features have been added
. catalogs have changed



Well, this just means a different piece of SQL needs to be sent for a
command depending on the server version, right?  It's not like that's
tremendously different.  The nice thing about most \X commands is that
they embed everything they need in a bunch of SQL, and they don't need
much else in C code.  So it's not all that difficult.

And for commands that have been added later, an initial version could
just say this server version does not support this command.  It would
be already a huge improvement.

Probably the biggest change would be to support versions that did not
have schemas, but I think it would be OK to punt on that.  We already
stopped supporting 7.2 anyway.
  


Have at it then. Prove me wrong.

cheers

andrew

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Tom Lane
Joshua D. Drake [EMAIL PROTECTED] writes:
 Andrew Dunstan wrote:
 Have at it then. Prove me wrong.

 IMO the problem isn't the one off support for all supported version of 
 Pg... say 7.4 - 8.4. The problem is of on going maintenance.

 /me doesn't think it is worth the effort.

Since no one's done it yet, that would seem to be the consensus
opinion :-)

Still, it'd be interesting to see an attempt at making it go.
The costs of doing it now for existing versions would probably give us
a good idea of what the future maintenance effort might be like.
Without a real patch to look at, we're all just guessing about that.

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-15 Thread Joshua D. Drake

Andrew Dunstan wrote:


And for commands that have been added later, an initial version could
just say this server version does not support this command.  It would
be already a huge improvement.

Probably the biggest change would be to support versions that did not
have schemas, but I think it would be OK to punt on that.  We already
stopped supporting 7.2 anyway.
  


Have at it then. Prove me wrong.


IMO the problem isn't the one off support for all supported version of 
Pg... say 7.4 - 8.4. The problem is of on going maintenance.


/me doesn't think it is worth the effort.

Sincerely,

Joshua D. Drake



--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Bruce Momjian
Joshua D. Drake wrote:
 On Wed, 23 Apr 2008 14:41:20 -0700
 Joshua D. Drake [EMAIL PROTECTED] wrote:
 
 Hello,
 
 Per final discussion here:
 
 http://archives.postgresql.org/pgsql-hackers/2008-04/msg01607.php

I have looked over this patch and made a few adjustments.

You used for a help startup banner:

Type: help for help.

I feel this has too much indirection because 'help' then produced:

You are using psql, the command-line interface to PostgreSQL.

\h or \\help for SQL help.
\? for psql help.
\q to quit psql.

\copyright to view the copyright.

Because \? now has \h, \q, and \copyright alone at the top I think we
should just use:

$ psql test
psql (8.4devel)   Type \? for help.

test=

If you type 'help' it just repeats the startup banner suggestion:

test= help

You are using psql, the command-line interface to PostgreSQL.
Type \? for help.

test=

I think that consistency will be clearer.  In the past we were trying to
avoid \?, but I think now it is clean enough to be used by new people
without confusion.

I also put the version number in parentheses so it wouldn't be as
prominent.

Updated patch attached.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/bin/psql/help.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.127
diff -c -c -r1.127 help.c
*** src/bin/psql/help.c	14 May 2008 15:30:22 -	1.127
--- src/bin/psql/help.c	14 May 2008 23:09:06 -
***
*** 176,182 
  
  	fprintf(output, _(Query Buffer\n));
  	fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) with external editor\n));
! 	fprintf(output, _(  \\g [FILE]  send query buffer to server (and results to file or |pipe)\n));
  	fprintf(output, _(  \\p show the contents of the query buffer\n));
  	fprintf(output, _(  \\r reset (clear) the query buffer\n));
  #ifdef USE_READLINE
--- 176,182 
  
  	fprintf(output, _(Query Buffer\n));
  	fprintf(output, _(  \\e [FILE]  edit the query buffer (or file) with external editor\n));
! 	fprintf(output, _(  \\g [FILE] or ; send query buffer to server (and results to file or |pipe)\n));
  	fprintf(output, _(  \\p show the contents of the query buffer\n));
  	fprintf(output, _(  \\r reset (clear) the query buffer\n));
  #ifdef USE_READLINE
Index: src/bin/psql/mainloop.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.90
diff -c -c -r1.90 mainloop.c
*** src/bin/psql/mainloop.c	5 Apr 2008 03:40:15 -	1.90
--- src/bin/psql/mainloop.c	14 May 2008 23:09:06 -
***
*** 177,186 
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_(You are using psql, the command-line interface to PostgreSQL.));
! 			puts(_(Enter SQL commands, or type \\? for a list of backslash options.));
! 			puts(_(Use \\h for SQL command help.));
! 			puts(_(Use \\q to quit.));
  			fflush(stdout);
  			continue;
  		}
--- 177,185 
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_(\nYou are using psql, the command-line interface to PostgreSQL.));
! 			puts(_(Type \\? for help.\n));
! 
  			fflush(stdout);
  			continue;
  		}
Index: src/bin/psql/startup.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.147
diff -c -c -r1.147 startup.c
*** src/bin/psql/startup.c	8 May 2008 17:04:26 -	1.147
--- src/bin/psql/startup.c	14 May 2008 23:09:06 -
***
*** 317,342 
  	server_version = server_ver_str;
  }
  
! printf(_(Welcome to %s %s (server %s), the PostgreSQL interactive terminal.\n\n),
! 	   pset.progname, PG_VERSION, server_version);
  			}
  			else
! printf(_(Welcome to %s %s, the PostgreSQL interactive terminal.\n\n),
! 	   pset.progname, PG_VERSION);
! 
! 			printf(_(Type:  \\copyright for distribution terms\n
! 	\\h for help with SQL commands\n
! 	\\? for help with psql commands\n
!  \\g or terminate with semicolon to execute query\n
! 	\\q to quit\n\n));
  
  			if (pset.sversion / 100 != client_ver / 100)
! printf(_(WARNING:  You are connected to a server with major version %d.%d,\n
! 		 but your %s client is major version %d.%d.  Some backslash commands,\n
! 		 such as \\d, might not work properly.\n\n),
! 	   pset.sversion / 1, (pset.sversion / 100) % 100,
! 	   pset.progname,
! 	   client_ver 

Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Bruce Momjian
 I think that consistency will be clearer.  In the past we were trying to
 avoid \?, but I think now it is clean enough to be used by new people
 without confusion.
 
 I also put the version number in parentheses so it wouldn't be as
 prominent.
 
 Updated patch attached.

FYI, after the patch is applied I will update psql banner examples in
our documentation.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Alvaro Herrera
Bruce Momjian wrote:

 If you type 'help' it just repeats the startup banner suggestion:
 
   test= help
   
   You are using psql, the command-line interface to PostgreSQL.
   Type \? for help.

I think we wanted to have more information in 'help', not less.  Making
it just repeat the startup info is not very helpful.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Bruce Momjian
Alvaro Herrera wrote:
 Bruce Momjian wrote:
 
  If you type 'help' it just repeats the startup banner suggestion:
  
  test= help
  
  You are using psql, the command-line interface to PostgreSQL.
  Type \? for help.
 
 I think we wanted to have more information in 'help', not less.  Making
 it just repeat the startup info is not very helpful.

I thought about that, but aren't we just repeating the top of \?.  Is
that helpful?  Should we just display \?.  

I know we decided not to do that, but I am trying to figure out what the
goal if 'help' is?  To display the most frequently-used help commands? 
Aren't they at the top of \?.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Joshua D. Drake

Bruce Momjian wrote:

Alvaro Herrera wrote:

Bruce Momjian wrote:


If you type 'help' it just repeats the startup banner suggestion:

test= help

You are using psql, the command-line interface to PostgreSQL.
Type \? for help.

I think we wanted to have more information in 'help', not less.  Making
it just repeat the startup info is not very helpful.


I thought about that, but aren't we just repeating the top of \?.  Is
that helpful?  Should we just display \?.  


I am a little confused here. The whole point of this patch is to remove 
all extraneous information from the startup banner and push it to a 
help screen. Thus type help for help.


If you type help you get your help options.



I know we decided not to do that, but I am trying to figure out what the
goal if 'help' is?  To display the most frequently-used help commands? 
Aren't they at the top of \?.




The purpose of help is to provide what help options there are available 
to those who need them.


Joshua D. Drake


--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Alvaro Herrera
Bruce Momjian wrote:

 I know we decided not to do that, but I am trying to figure out what the
 goal if 'help' is?  To display the most frequently-used help commands? 
 Aren't they at the top of \?.

The purpose of 'help' is to provide useful help.  If it only says see \?
then it's just redirecting you somewhere else, which isn't useful.

I don't think the various help commands need to be completely
orthogonal.  If you agree with that, then making 'help' repeat part of
what \? says is acceptable.  (Of course, the idea is not just to repeat,
but also to provide useful advice to the unwary.)

Remember, the people who is going to type 'help' is not the 10-year-Pg-
experience types.  It's the newbies.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Bruce Momjian
Alvaro Herrera wrote:
 Bruce Momjian wrote:
 
  I know we decided not to do that, but I am trying to figure out what the
  goal if 'help' is?  To display the most frequently-used help commands? 
  Aren't they at the top of \?.
 
 The purpose of 'help' is to provide useful help.  If it only says see \?
 then it's just redirecting you somewhere else, which isn't useful.
 
 I don't think the various help commands need to be completely
 orthogonal.  If you agree with that, then making 'help' repeat part of
 what \? says is acceptable.  (Of course, the idea is not just to repeat,
 but also to provide useful advice to the unwary.)

OK.

 Remember, the people who is going to type 'help' is not the 10-year-Pg-
 experience types.  It's the newbies.

The larger issue is whether we want to advertise only help in the
startup banner.  The patch has just:

Type: help for help.

Now, aside from being confusing (we need quotes around help), I
thought we should only mention \?.

My question is whether we agreed that suggesting help as the best way
to get help was what we agreed upon?  If we did, I forgot.  I thought
the 'help' ideas was just for people who forgot the help commands.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Alvaro Herrera
Bruce Momjian wrote:

 My question is whether we agreed that suggesting help as the best way
 to get help was what we agreed upon?  If we did, I forgot.  I thought
 the 'help' ideas was just for people who forgot the help commands.

Please review the previous discussion:

http://archives.postgresql.org/message-id/1200851790.19135.68.camel%40greg-laptop

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Bruce Momjian
Alvaro Herrera wrote:
 Bruce Momjian wrote:
 
  My question is whether we agreed that suggesting help as the best way
  to get help was what we agreed upon?  If we did, I forgot.  I thought
  the 'help' ideas was just for people who forgot the help commands.
 
 Please review the previous discussion:
 
 http://archives.postgresql.org/message-id/1200851790.19135.68.camel%40greg-laptop

OK, I just read the thread and saw no one say we should be promoting
_only_ 'help' in the startup banner.  Where is that email discussion?

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Joshua D. Drake

Bruce Momjian wrote:

Alvaro Herrera wrote:

Bruce Momjian wrote:


My question is whether we agreed that suggesting help as the best way
to get help was what we agreed upon?  If we did, I forgot.  I thought
the 'help' ideas was just for people who forgot the help commands.

Please review the previous discussion:

http://archives.postgresql.org/message-id/1200851790.19135.68.camel%40greg-laptop


OK, I just read the thread and saw no one say we should be promoting
_only_ 'help' in the startup banner.  Where is that email discussion?



http://archives.postgresql.org/pgsql-hackers/2008-04/msg01476.php

And most specifically:

http://archives.postgresql.org/pgsql-hackers/2008-04/msg01376.php

Joshua D. Drake

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Bruce Momjian
Joshua D. Drake wrote:
 Bruce Momjian wrote:
  Alvaro Herrera wrote:
  Bruce Momjian wrote:
 
  My question is whether we agreed that suggesting help as the best way
  to get help was what we agreed upon?  If we did, I forgot.  I thought
  the 'help' ideas was just for people who forgot the help commands.
  Please review the previous discussion:
 
  http://archives.postgresql.org/message-id/1200851790.19135.68.camel%40greg-laptop
  
  OK, I just read the thread and saw no one say we should be promoting
  _only_ 'help' in the startup banner.  Where is that email discussion?
  
 
 http://archives.postgresql.org/pgsql-hackers/2008-04/msg01476.php
 
 And most specifically:
 
 http://archives.postgresql.org/pgsql-hackers/2008-04/msg01376.php

Ah, OK.  I had forgotten.  Here is the new output:

$ sql test
psql (8.4devel)   Type help for help.

test= help

You are using psql, the command-line interface to PostgreSQL.
\h or \help for SQL help
\? for psql help
\q to quit psql

\copyright to view the copyright

test= \?
General
  \copyright show PostgreSQL usage and distribution terms
  \g [FILE] or ; send query buffer to server (and results to file or 
|pipe)
  \h [NAME]  help on syntax of SQL commands, * for all commands
  \q quit psql

Query Buffer
  \e [FILE]  edit the query buffer (or file) with external editor
...

I moved '\g' up into the General section rather than make it a
single-entry section.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Joshua D. Drake

Bruce Momjian wrote:



test= \?
General
  \copyright show PostgreSQL usage and distribution terms
  \g [FILE] or ; send query buffer to server (and results to file or 
|pipe)
  \h [NAME]  help on syntax of SQL commands, * for all commands
  \q quit psql

Query Buffer
  \e [FILE]  edit the query buffer (or file) with external editor
...

I moved '\g' up into the General section rather than make it a
single-entry section.


send query buffer to server means nothing to a newbie. You execute 
queries, you don't send buffers (from a user perspective).


Sincerely,

Joshua D. Drake


--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Bruce Momjian
Joshua D. Drake wrote:
 Bruce Momjian wrote:
 
  
  test= \?
  General
\copyright show PostgreSQL usage and distribution terms
\g [FILE] or ; send query buffer to server (and results to file or 
  |pipe)
\h [NAME]  help on syntax of SQL commands, * for all commands
\q quit psql
  
  Query Buffer
\e [FILE]  edit the query buffer (or file) with external editor
  ...
  
  I moved '\g' up into the General section rather than make it a
  single-entry section.
 
 send query buffer to server means nothing to a newbie. You execute 
 queries, you don't send buffers (from a user perspective).

Yep, good, updated:

General
  \copyright show PostgreSQL usage and distribution terms
  \g [FILE] or ; execute query (and send results to file or |pipe)
  \h [NAME]  help on syntax of SQL commands, * for all commands
  \q quit psql


-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-05-14 Thread Joshua D. Drake

Bruce Momjian wrote:

Joshua D. Drake wrote:

Bruce Momjian wrote:



I moved '\g' up into the General section rather than make it a
single-entry section.
send query buffer to server means nothing to a newbie. You execute 
queries, you don't send buffers (from a user perspective).


Yep, good, updated:

General
  \copyright show PostgreSQL usage and distribution terms
  \g [FILE] or ; execute query (and send results to file or |pipe)
  \h [NAME]  help on syntax of SQL commands, * for all commands
  \q quit psql




Cool.

Joshua D. Drake

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-04-23 Thread Joshua D. Drake
On Wed, 23 Apr 2008 14:41:20 -0700
Joshua D. Drake [EMAIL PROTECTED] wrote:

Hello,

Per final discussion here:

http://archives.postgresql.org/pgsql-hackers/2008-04/msg01607.php

Joshua D. Drake


-- 
The PostgreSQL Company since 1997: http://www.commandprompt.com/ 
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


Index: help.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.126
diff -c -r1.126 help.c
*** help.c	4 Apr 2008 18:00:25 -	1.126
--- help.c	23 Apr 2008 22:07:24 -
***
*** 168,173 
--- 168,175 
  	 * if this  is the start of the string then it ought to end there to fit
  	 * in 80 columns  
  	 */
+ 	fprintf(output, _(Execution\n));
+ 	fprintf(output, _(  \\g or ;	 execute query\n\n));
  	fprintf(output, _(General\n));
  	fprintf(output, _(  \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n
  			 connect to new database (currently \%s\)\n),
Index: mainloop.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.90
diff -c -r1.90 mainloop.c
*** mainloop.c	5 Apr 2008 03:40:15 -	1.90
--- mainloop.c	23 Apr 2008 22:07:24 -
***
*** 177,186 
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_(You are using psql, the command-line interface to PostgreSQL.));
! 			puts(_(Enter SQL commands, or type \\? for a list of backslash options.));
! 			puts(_(Use \\h for SQL command help.));
! 			puts(_(Use \\q to quit.));
  			fflush(stdout);
  			continue;
  		}
--- 177,189 
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_(\n));
! 			puts(_(You are using psql, the command-line interface to PostgreSQL.\n));
! 			puts(_(\t\\h or \\help for SQL help.));
! 			puts(_(\t\\? for psql help.));
! 			puts(_(\t\\q to quit psql.\n));
! 			puts(_(\t\\copyright to view the copyright.\n));
! 
  			fflush(stdout);
  			continue;
  		}
Index: startup.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.146
diff -c -r1.146 startup.c
*** startup.c	1 Jan 2008 19:45:56 -	1.146
--- startup.c	23 Apr 2008 22:07:24 -
***
*** 315,340 
  	server_version = server_ver_str;
  }
  
! printf(_(Welcome to %s %s (server %s), the PostgreSQL interactive terminal.\n\n),
! 	   pset.progname, PG_VERSION, server_version);
! 			}
! 			else
! printf(_(Welcome to %s %s, the PostgreSQL interactive terminal.\n\n),
! 	   pset.progname, PG_VERSION);
! 
! 			printf(_(Type:  \\copyright for distribution terms\n
! 	\\h for help with SQL commands\n
! 	\\? for help with psql commands\n
!  \\g or terminate with semicolon to execute query\n
! 	\\q to quit\n\n));
  
  			if (pset.sversion / 100 != client_ver / 100)
! printf(_(WARNING:  You are connected to a server with major version %d.%d,\n
! 		 but your %s client is major version %d.%d.  Some backslash commands,\n
! 		 such as \\d, might not work properly.\n\n),
! 	   pset.sversion / 1, (pset.sversion / 100) % 100,
! 	   pset.progname,
! 	   client_ver / 1, (client_ver / 100) % 100);
  
  #ifdef USE_SSL
  			printSSLInfo();
--- 315,334 
  	server_version = server_ver_str;
  }
  
! printf(_(\n\t%s %s (server %s)\n\n), 
! 	pset.progname, PG_VERSION, server_version);
! }
! else
! 	printf(_(%s %s\n\n),
! 	pset.progname, PG_VERSION);
  
  			if (pset.sversion / 100 != client_ver / 100)
! printf(_(\tWARNING: Server version %d.%d, %s version %d.%d.\n
! 	 \tSome psql features may not work.\n\n),
! 	pset.sversion / 1, (pset.sversion / 100) % 100,
! 	pset.progname, client_ver / 1, (client_ver / 100) % 100);
! 
! 			printf(_(Type: help for help.\n));
  
  #ifdef USE_SSL
  			printSSLInfo();

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] Patch to change psql default banner v6

2008-04-23 Thread Bruce Momjian
Joshua D. Drake wrote:
 On Wed, 23 Apr 2008 14:41:20 -0700
 Joshua D. Drake [EMAIL PROTECTED] wrote:
 
 Hello,
 
 Per final discussion here:
 
 http://archives.postgresql.org/pgsql-hackers/2008-04/msg01607.php

Isn't this going to mean \g is listed twice?

+   fprintf(output, _(Execution\n));
+   fprintf(output, _(  \\g or ;execute query\n\n));

If you want I can look at reorganizing the \? help.  I have a larger
reorganization mind.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches