Lists: | pgsql-hackers |
---|
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | psql 8.4 \c repeats version banner |
Date: | 2009-12-28 16:50:02 |
Message-ID: | 1262019002.10841.5.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
In 8.3, running \c from a file prints something like
You are now connected to database "postgres".
In 8.4 it prints
psql (8.4.1)
You are now connected to database "postgres".
Is it intentional/sensible to repeat the startup banner every time the
connection changes, or was this unintentionally introduced while the
startup banner was reshuffled in 8.4?
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: psql 8.4 \c repeats version banner |
Date: | 2009-12-28 17:21:03 |
Message-ID: | 12208.1262020863@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> In 8.3, running \c from a file prints something like
> You are now connected to database "postgres".
> In 8.4 it prints
> psql (8.4.1)
> You are now connected to database "postgres".
> Is it intentional/sensible to repeat the startup banner every time the
> connection changes, or was this unintentionally introduced while the
> startup banner was reshuffled in 8.4?
I think the argument was that if you are connecting to a new server, the
server version number could change, and so it is useful to repeat that
line to have a place to display the possible version mismatch indicator.
Maybe we could suppress it if the third and fourth arguments are
omitted, but I'm not sure it's worth the trouble.
The original design didn't have the third and fourth arguments, hence no
possibility of server change.
regards, tom lane
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: psql 8.4 \c repeats version banner |
Date: | 2010-02-06 17:35:42 |
Message-ID: | 201002061735.o16HZgw12992@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Peter Eisentraut wrote:
> In 8.3, running \c from a file prints something like
>
> You are now connected to database "postgres".
>
> In 8.4 it prints
>
> psql (8.4.1)
> You are now connected to database "postgres".
>
> Is it intentional/sensible to repeat the startup banner every time the
> connection changes, or was this unintentionally introduced while the
> startup banner was reshuffled in 8.4?
I did some reseach on this. I bet this behavior was added when we
decided to print the backend version warning banner on \c as well as
startup, because it is possible for the backend to be different version
from the backend originally used for psql startup. The code that prints
the psql banner and the warning banner are in the same function and
share the same output line.
What I did in the attached patch is to add a boolean to
connection_warnings() to indicate whether it was being called on psql
startup or via \c, and to supress the psql banner on \c if the client
and server versions match:
$ psql test
psql (8.5devel)
Type "help" for help.
test=> \c test
You are now connected to database "test".
test=>
Any version mismatch will still print the psql banner for \c, which is
what I think we want.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachment | Content-Type | Size |
---|---|---|
/pgpatches/psql_banner | text/x-diff | 2.9 KB |
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: psql 8.4 \c repeats version banner |
Date: | 2010-02-16 21:07:03 |
Message-ID: | 201002162107.o1GL73d02304@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Applied.
---------------------------------------------------------------------------
Bruce Momjian wrote:
> Peter Eisentraut wrote:
> > In 8.3, running \c from a file prints something like
> >
> > You are now connected to database "postgres".
> >
> > In 8.4 it prints
> >
> > psql (8.4.1)
> > You are now connected to database "postgres".
> >
> > Is it intentional/sensible to repeat the startup banner every time the
> > connection changes, or was this unintentionally introduced while the
> > startup banner was reshuffled in 8.4?
>
> I did some reseach on this. I bet this behavior was added when we
> decided to print the backend version warning banner on \c as well as
> startup, because it is possible for the backend to be different version
> from the backend originally used for psql startup. The code that prints
> the psql banner and the warning banner are in the same function and
> share the same output line.
>
> What I did in the attached patch is to add a boolean to
> connection_warnings() to indicate whether it was being called on psql
> startup or via \c, and to supress the psql banner on \c if the client
> and server versions match:
>
> $ psql test
> psql (8.5devel)
> Type "help" for help.
>
> test=> \c test
> You are now connected to database "test".
> test=>
>
> Any version mismatch will still print the psql banner for \c, which is
> what I think we want.
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + If your life is a hard drive, Christ can be your backup. +
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +