pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: psql: fix \connect with URIs and conninfo strings
22+ messages / 6 participants
[nested] [flat]
* pgsql: psql: fix \connect with URIs and conninfo strings
@ 2015-04-01 23:10 Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-01 23:10 UTC (permalink / raw)
To: pgsql-committers
psql: fix \connect with URIs and conninfo strings
psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.
Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments. Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.
There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts. Therefore this is backpatched all the way back to 9.0.
To implement this, routines previously private to libpq have been
duplicated so that psql can decide what looks like a conninfo/URI
string. In back branches, just duplicate the same code all the way back
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.
In master, the routines are moved to src/common and renamed.
Author: David Fetter, Andrew Dunstan. Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/fcef1617295c074f2684c887627184d2fc26ac04
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 40 ++++++++++++++-----
src/bin/psql/command.c | 80 ++++++++++++++++++++++++++-----------
src/bin/psql/help.c | 4 +-
src/bin/psql/tab-complete.c | 13 +++++-
src/common/Makefile | 2 +-
src/common/connstrings.c | 53 ++++++++++++++++++++++++
src/include/common/connstrings.h | 16 ++++++++
src/interfaces/libpq/fe-connect.c | 46 +++------------------
8 files changed, 175 insertions(+), 79 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2015-04-02 01:29 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Michael Paquier @ 2015-04-02 01:29 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers
On Thu, Apr 2, 2015 at 8:10 AM, Alvaro Herrera <alvherre@alvh.no-ip.org>
wrote:
> psql: fix \connect with URIs and conninfo strings
>
> psql was already accepting conninfo strings as the first parameter in
> \connect, but the way it worked wasn't sane; some of the other
> parameters would get the previous connection's values, causing it to
> connect to a completely unexpected server or, more likely, not finding
> any server at all because of completely wrong combinations of
> parameters.
>
This patch has broken the build on OSX:
http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dromedary&dt=2015-04-02%2000%3A10%3A54
My box complains as well.
I haven't looked at that in details, but it looks that there are linking
problems with -lpgcommon, as it is the first time that libpq has a
dependency with it.
I am seeing as well that this is at least missing at the top of
connstring.c:
#ifndef FRONTEND
#error "This file is not expected to be compiled for backend code"
#endif
And that src/tools/msvc has not been updated to have connstring.c show up
in the list of frontend-only objects for libpgcommon.
--
Michael
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
@ 2015-04-02 01:58 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-02 02:36 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
0 siblings, 2 replies; 22+ messages in thread
From: Michael Paquier @ 2015-04-02 01:58 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers
On Thu, Apr 2, 2015 at 10:29 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:
>
>
>
> On Thu, Apr 2, 2015 at 8:10 AM, Alvaro Herrera <alvherre@alvh.no-ip.org>
> wrote:
>
>> psql: fix \connect with URIs and conninfo strings
>>
>> psql was already accepting conninfo strings as the first parameter in
>> \connect, but the way it worked wasn't sane; some of the other
>> parameters would get the previous connection's values, causing it to
>> connect to a completely unexpected server or, more likely, not finding
>> any server at all because of completely wrong combinations of
>> parameters.
>>
>
> This patch has broken the build on OSX:
>
> http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dromedary&dt=2015-04-02%2000%3A10%3A54
> My box complains as well.
>
> I haven't looked at that in details, but it looks that there are linking
> problems with -lpgcommon, as it is the first time that libpq has a
> dependency with it.
>
> I am seeing as well that this is at least missing at the top of
> connstring.c:
> #ifndef FRONTEND
> #error "This file is not expected to be compiled for backend code"
> #endif
> And that src/tools/msvc has not been updated to have connstring.c show up
> in the list of frontend-only objects for libpgcommon.
>
On other Linux machines, tests for dblink are failing:
+ ERROR: could not load library
"/usr/src/pgfarm/build/HEAD/inst/lib/postgresql/dblink.so":
/usr/src/pgfarm/build/HEAD/inst/lib/libpq.so.5: undefined symbol:
libpq_connstring_is_recognized
--
Michael
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
@ 2015-04-02 02:36 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-02 02:49 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 22+ messages in thread
From: Michael Paquier @ 2015-04-02 02:36 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers
On Thu, Apr 2, 2015 at 10:58 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:
>
> On other Linux machines, tests for dblink are failing:
> + ERROR: could not load library
> "/usr/src/pgfarm/build/HEAD/inst/lib/postgresql/dblink.so":
> /usr/src/pgfarm/build/HEAD/inst/lib/libpq.so.5: undefined symbol:
> libpq_connstring_is_recognized
>
The patch attached fixes all those inconsistencies (tested build on OSX and
Windows).
--
Michael
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Attachments:
0001-Fix-libpq-build-errors-caused-by-fcef1617.patch (text/x-patch, 3.1K) download
From 188b8e51df428e650d9cc23b4a67d7516a1e5e47 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Thu, 2 Apr 2015 11:13:42 +0900
Subject: [PATCH] Fix libpq build errors caused by fcef1617
libpq build was missing a reference to the new file connstrings.c,
leading to build errors on OSX and Windows, and regression test errors
for dblink as it tried to load a version of libpq missing dependencies.
---
src/common/connstrings.c | 4 ++++
src/interfaces/libpq/.gitignore | 1 +
src/interfaces/libpq/Makefile | 7 ++++++-
src/tools/msvc/Mkvcbuild.pm | 4 ++--
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/common/connstrings.c b/src/common/connstrings.c
index 91170a1..ad714ab 100644
--- a/src/common/connstrings.c
+++ b/src/common/connstrings.c
@@ -6,6 +6,10 @@
*
* src/include/common/connstrings.c
*/
+#ifndef FRONTEND
+#error "This file is not expected to be compiled for backend code"
+#endif
+
#include "postgres_fe.h"
#include <string.h>
diff --git a/src/interfaces/libpq/.gitignore b/src/interfaces/libpq/.gitignore
index cb96af7..a28dff9 100644
--- a/src/interfaces/libpq/.gitignore
+++ b/src/interfaces/libpq/.gitignore
@@ -1,5 +1,6 @@
/exports.list
/chklocale.c
+/connstrings.c
/crypt.c
/getaddrinfo.c
/getpeereid.c
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 6973a20..513f981 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -27,7 +27,7 @@ endif
# Need to recompile any external C files because we need
# all object files to use the same compile flags as libpq; some
# platforms require special flags.
-LIBS := $(LIBS:-lpgport=)
+LIBS := $(filter -lpgport -lpgcommon, $(LIBS))
# We can't use Makefile variables here because the MSVC build system scrapes
# OBJS from this file.
@@ -43,6 +43,8 @@ OBJS += $(filter crypt.o getaddrinfo.o getpeereid.o inet_aton.o open.o system.o
OBJS += ip.o md5.o
# utils/mb
OBJS += encnames.o wchar.o
+# common/
+OBJS += connstrings.o
ifeq ($(with_openssl),yes)
OBJS += fe-secure-openssl.o
@@ -96,6 +98,9 @@ backend_src = $(top_srcdir)/src/backend
chklocale.c crypt.c getaddrinfo.c getpeereid.c inet_aton.c inet_net_ntop.c noblock.c open.c system.c pgsleep.c pgstrcasecmp.c pqsignal.c snprintf.c strerror.c strlcpy.c thread.c win32error.c win32setlocale.c: % : $(top_srcdir)/src/port/%
rm -f $@ && $(LN_S) $< .
+connstrings.c: % : $(top_srcdir)/src/common/%
+ rm -f $@ && $(LN_S) $< .
+
ip.c md5.c: % : $(backend_src)/libpq/%
rm -f $@ && $(LN_S) $< .
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f319df..5175d30 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -95,8 +95,8 @@ sub mkvcbuild
exec.c pg_crc.c pg_lzcompress.c pgfnames.c psprintf.c relpath.c rmtree.c
string.c username.c wait_error.c);
- our @pgcommonfrontendfiles = (@pgcommonallfiles, qw(fe_memutils.c
- restricted_token.c));
+ our @pgcommonfrontendfiles = (@pgcommonallfiles, qw(connstrings.c
+ fe_memutils.c restricted_token.c));
our @pgcommonbkndfiles = @pgcommonallfiles;
--
2.3.5
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 02:36 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
@ 2015-04-02 02:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 02:56 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Tom Lane @ 2015-04-02 02:49 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
Michael Paquier <michael.paquier@gmail.com> writes:
> The patch attached fixes all those inconsistencies (tested build on OSX and
> Windows).
I think this is going in the wrong direction entirely, ie doubling down
on Alvaro's original mistake. libpq *must not* depend on libpgcommon,
because the latter is not compiled to be position-independent code
(on machines where that matters). Furthermore, proposing to add this:
+#ifndef FRONTEND
+#error "This file is not expected to be compiled for backend code"
+#endif
seems to me to prove that connstrings.c didn't belong in src/common
in the first place.
I'm too tired to think through exactly what this should be like instead,
but we do have rules about what goes where, and the response to violating
those rules should not be to break down the divisions even more.
regards, tom lane
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 02:36 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 02:49 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
@ 2015-04-02 02:56 ` Michael Paquier <michael.paquier@gmail.com>
0 siblings, 0 replies; 22+ messages in thread
From: Michael Paquier @ 2015-04-02 02:56 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
On Thu, Apr 2, 2015 at 11:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
> > The patch attached fixes all those inconsistencies (tested build on OSX
> and
> > Windows).
>
> I think this is going in the wrong direction entirely, ie doubling down
> on Alvaro's original mistake. libpq *must not* depend on libpgcommon,
> because the latter is not compiled to be position-independent code
> (on machines where that matters).
>
Hm, OK. I was not aware of that.
> Furthermore, proposing to add this:
>
> +#ifndef FRONTEND
> +#error "This file is not expected to be compiled for backend code"
> +#endif
>
> seems to me to prove that connstrings.c didn't belong in src/common
> in the first place.
>
> I'm too tired to think through exactly what this should be like instead,
> but we do have rules about what goes where, and the response to violating
> those rules should not be to break down the divisions even more.
>
libpgport sounds like the only place then. I guess that it would be right
to revert this patch on master and replace it with a version similar to
what has been done in backbranches for now, and look again at this
refactoring stuff...
--
Michael
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
@ 2015-04-02 13:42 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 22+ messages in thread
From: Robert Haas @ 2015-04-02 13:42 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
On Wed, Apr 1, 2015 at 9:58 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On other Linux machines, tests for dblink are failing:
> + ERROR: could not load library
> "/usr/src/pgfarm/build/HEAD/inst/lib/postgresql/dblink.so":
> /usr/src/pgfarm/build/HEAD/inst/lib/libpq.so.5: undefined symbol:
> libpq_connstring_is_recognized
I can't even build the server.
ar crs libpq.a fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o
fe-lobj.o fe-protocol2.o fe-protocol3.o pqexpbuffer.o fe-secure.o
libpq-events.o chklocale.o inet_net_ntop.o noblock.o pgstrcasecmp.o
pqsignal.o thread.o ip.o md5.o encnames.o wchar.o fe-secure-openssl.o
Undefined symbols for architecture x86_64:
"_libpq_connstring_is_recognized", referenced from:
_PQconnectStartParams in fe-connect.o
_PQsetdbLogin in fe-connect.o
"_libpq_connstring_uri_prefix_length", referenced from:
_parse_connection_string in fe-connect.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
This is really inconvenient.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
@ 2015-04-02 14:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Tom Lane @ 2015-04-02 14:00 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
Robert Haas <robertmhaas@gmail.com> writes:
> This is really inconvenient.
I'm going to revert that commit in HEAD shortly, unless Alvaro pops
up and promises a fix PDQ. Or you could do the same.
regards, tom lane
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
@ 2015-04-02 14:01 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 22+ messages in thread
From: Robert Haas @ 2015-04-02 14:01 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
On Thu, Apr 2, 2015 at 10:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> This is really inconvenient.
>
> I'm going to revert that commit in HEAD shortly, unless Alvaro pops
> up and promises a fix PDQ. Or you could do the same.
I was thinking of changing master to look like the 9.4 version.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
@ 2015-04-02 14:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:19 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Tom Lane @ 2015-04-02 14:09 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Apr 2, 2015 at 10:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'm going to revert that commit in HEAD shortly, unless Alvaro pops
>> up and promises a fix PDQ. Or you could do the same.
> I was thinking of changing master to look like the 9.4 version.
[ shrug... ] IMO, a quick "git revert" is less work and leaves a cleaner
state for Alvaro to apply whatever final solution he settles on.
But do what you wish.
regards, tom lane
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
@ 2015-04-02 14:19 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:38 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 22+ messages in thread
From: Robert Haas @ 2015-04-02 14:19 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
On Thu, Apr 2, 2015 at 10:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Thu, Apr 2, 2015 at 10:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I'm going to revert that commit in HEAD shortly, unless Alvaro pops
>>> up and promises a fix PDQ. Or you could do the same.
>
>> I was thinking of changing master to look like the 9.4 version.
>
> [ shrug... ] IMO, a quick "git revert" is less work and leaves a cleaner
> state for Alvaro to apply whatever final solution he settles on.
> But do what you wish.
OK, I've just reverted it.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:19 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
@ 2015-04-02 14:38 ` Bruce Momjian <bruce@momjian.us>
2015-04-02 14:41 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Bruce Momjian @ 2015-04-02 14:38 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
On Thu, Apr 2, 2015 at 10:19:51AM -0400, Robert Haas wrote:
> On Thu, Apr 2, 2015 at 10:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Robert Haas <robertmhaas@gmail.com> writes:
> >> On Thu, Apr 2, 2015 at 10:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >>> I'm going to revert that commit in HEAD shortly, unless Alvaro pops
> >>> up and promises a fix PDQ. Or you could do the same.
> >
> >> I was thinking of changing master to look like the 9.4 version.
> >
> > [ shrug... ] IMO, a quick "git revert" is less work and leaves a cleaner
> > state for Alvaro to apply whatever final solution he settles on.
> > But do what you wish.
>
> OK, I've just reverted it.
Can I ask about the logic of why this bug fix was backpatched, or is
that clear to everyone but me.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:19 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:38 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
@ 2015-04-02 14:41 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:57 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 22+ messages in thread
From: Robert Haas @ 2015-04-02 14:41 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
On Thu, Apr 2, 2015 at 10:38 AM, Bruce Momjian <bruce@momjian.us> wrote:
> On Thu, Apr 2, 2015 at 10:19:51AM -0400, Robert Haas wrote:
>> On Thu, Apr 2, 2015 at 10:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> > Robert Haas <robertmhaas@gmail.com> writes:
>> >> On Thu, Apr 2, 2015 at 10:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> >>> I'm going to revert that commit in HEAD shortly, unless Alvaro pops
>> >>> up and promises a fix PDQ. Or you could do the same.
>> >
>> >> I was thinking of changing master to look like the 9.4 version.
>> >
>> > [ shrug... ] IMO, a quick "git revert" is less work and leaves a cleaner
>> > state for Alvaro to apply whatever final solution he settles on.
>> > But do what you wish.
>>
>> OK, I've just reverted it.
>
> Can I ask about the logic of why this bug fix was backpatched, or is
> that clear to everyone but me.
What is your question, exactly? There was a fair amount of discussion
of whether and how to back-patch this on pgsql-hackers.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:19 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:38 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
2015-04-02 14:41 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
@ 2015-04-02 14:57 ` Bruce Momjian <bruce@momjian.us>
2015-04-02 15:06 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Bruce Momjian @ 2015-04-02 14:57 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
eOn Thu, Apr 2, 2015 at 10:41:55AM -0400, Robert Haas wrote:
> On Thu, Apr 2, 2015 at 10:38 AM, Bruce Momjian <bruce@momjian.us> wrote:
> > On Thu, Apr 2, 2015 at 10:19:51AM -0400, Robert Haas wrote:
> >> On Thu, Apr 2, 2015 at 10:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> > Robert Haas <robertmhaas@gmail.com> writes:
> >> >> On Thu, Apr 2, 2015 at 10:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> >>> I'm going to revert that commit in HEAD shortly, unless Alvaro pops
> >> >>> up and promises a fix PDQ. Or you could do the same.
> >> >
> >> >> I was thinking of changing master to look like the 9.4 version.
> >> >
> >> > [ shrug... ] IMO, a quick "git revert" is less work and leaves a cleaner
> >> > state for Alvaro to apply whatever final solution he settles on.
> >> > But do what you wish.
> >>
> >> OK, I've just reverted it.
> >
> > Can I ask about the logic of why this bug fix was backpatched, or is
> > that clear to everyone but me.
>
> What is your question, exactly? There was a fair amount of discussion
> of whether and how to back-patch this on pgsql-hackers.
Uh, I didn't see a huge amount of discussion, but I guess it is
sufficient:
http://www.postgresql.org/message-id/flat/20150109191551.GA32660@fetter.org#20150109191551.GA32660@f...
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:19 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:38 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
2015-04-02 14:41 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:57 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
@ 2015-04-02 15:06 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 16:05 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 22+ messages in thread
From: Robert Haas @ 2015-04-02 15:06 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers
On Thu, Apr 2, 2015 at 10:57 AM, Bruce Momjian <bruce@momjian.us> wrote:
> Uh, I didn't see a huge amount of discussion, but I guess it is
> sufficient:
>
> http://www.postgresql.org/message-id/flat/20150109191551.GA32660@fetter.org#20150109191551.GA32660@f...
There are at least a dozen messages on that thread that are entirely
dedicated to whether this should be back-patched. How much discussion
did you want?
Now, mind you, my view did not prevail, so I can't be completely happy
with the outcome, but I was in the minority. At least the version
that broke essentially the entire build-farm only went into master, so
that's something.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: pgsql: psql: fix \connect with URIs and conninfo strings
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:19 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:38 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
2015-04-02 14:41 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:57 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Bruce Momjian <bruce@momjian.us>
2015-04-02 15:06 ` Re: pgsql: psql: fix \connect with URIs and conninfo strings Robert Haas <robertmhaas@gmail.com>
@ 2015-04-02 16:05 ` Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 0 replies; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-02 16:05 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: Bruce Momjian <bruce@momjian.us>; Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; pgsql-committers
Robert Haas wrote:
> On Thu, Apr 2, 2015 at 10:57 AM, Bruce Momjian <bruce@momjian.us> wrote:
> > Uh, I didn't see a huge amount of discussion, but I guess it is
> > sufficient:
> >
> > http://www.postgresql.org/message-id/flat/20150109191551.GA32660@fetter.org#20150109191551.GA32660@f...
>
> There are at least a dozen messages on that thread that are entirely
> dedicated to whether this should be back-patched. How much discussion
> did you want?
Yeah, this patch did get more discussion than many other patches do.
Sometimes you just have to go against what looks like apathy, and move
forward. That's what commitfests are supposed to be good for, after
all: personally, I care not one bit about this functionality, but
somebody went huge lengths to get it to work, which must mean that there
definitely is value in it.
> Now, mind you, my view did not prevail, so I can't be completely happy
> with the outcome, but I was in the minority. At least the version
> that broke essentially the entire build-farm only went into master, so
> that's something.
Yeah, I realized that backpatching the refactoring was the wrong
approach, though I didn't notice the breakage in master until it was
much too late. I pushed the 9.4 version to master now. Apologies for
not fixing it sooner -- had a funeral to attend, a drive 5 hours away.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* pgsql: psql: fix \connect with URIs and conninfo strings
@ 2015-04-01 23:10 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-01 23:10 UTC (permalink / raw)
To: pgsql-committers
psql: fix \connect with URIs and conninfo strings
psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.
Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments. Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.
There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts. Therefore this is backpatched all the way back to 9.0.
To implement this, routines previously private to libpq have been
duplicated so that psql can decide what looks like a conninfo/URI
string. In back branches, just duplicate the same code all the way back
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.
In master, the routines are moved to src/common and renamed.
Author: David Fetter, Andrew Dunstan. Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.
Branch
------
REL9_4_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/a44e54cf4b75159025ca8ff769c754123feb96a5
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 40 ++++++++++++++------
src/bin/psql/command.c | 79 ++++++++++++++++++++++++++++------------
src/bin/psql/common.c | 41 +++++++++++++++++++++
src/bin/psql/common.h | 2 +
src/bin/psql/help.c | 4 +-
src/bin/psql/tab-complete.c | 5 ++-
6 files changed, 134 insertions(+), 37 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* pgsql: psql: fix \connect with URIs and conninfo strings
@ 2015-04-01 23:10 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-01 23:10 UTC (permalink / raw)
To: pgsql-committers
psql: fix \connect with URIs and conninfo strings
psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.
Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments. Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.
There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts. Therefore this is backpatched all the way back to 9.0.
To implement this, routines previously private to libpq have been
duplicated so that psql can decide what looks like a conninfo/URI
string. In back branches, just duplicate the same code all the way back
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.
In master, the routines are moved to src/common and renamed.
Author: David Fetter, Andrew Dunstan. Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.
Branch
------
REL9_3_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/f4540cae10d8642b59deea50869888b78f16d722
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 40 ++++++++++++++------
src/bin/psql/command.c | 79 ++++++++++++++++++++++++++++------------
src/bin/psql/common.c | 41 +++++++++++++++++++++
src/bin/psql/common.h | 2 +
src/bin/psql/help.c | 4 +-
src/bin/psql/tab-complete.c | 5 ++-
6 files changed, 134 insertions(+), 37 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* pgsql: psql: fix \connect with URIs and conninfo strings
@ 2015-04-01 23:10 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-01 23:10 UTC (permalink / raw)
To: pgsql-committers
psql: fix \connect with URIs and conninfo strings
psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.
Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments. Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.
There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts. Therefore this is backpatched all the way back to 9.0.
To implement this, routines previously private to libpq have been
duplicated so that psql can decide what looks like a conninfo/URI
string. In back branches, just duplicate the same code all the way back
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.
In master, the routines are moved to src/common and renamed.
Author: David Fetter, Andrew Dunstan. Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.
Branch
------
REL9_2_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/d4bacdcb97928d20d61fcbc8d1305b504fea38f8
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 40 ++++++++++++++++-------
src/bin/psql/command.c | 69 ++++++++++++++++++++++++++++------------
src/bin/psql/common.c | 41 ++++++++++++++++++++++++
src/bin/psql/common.h | 2 ++
src/bin/psql/help.c | 4 +--
src/bin/psql/tab-complete.c | 6 ++--
6 files changed, 127 insertions(+), 35 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* pgsql: psql: fix \connect with URIs and conninfo strings
@ 2015-04-01 23:10 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-01 23:10 UTC (permalink / raw)
To: pgsql-committers
psql: fix \connect with URIs and conninfo strings
psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.
Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments. Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.
There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts. Therefore this is backpatched all the way back to 9.0.
To implement this, routines previously private to libpq have been
duplicated so that psql can decide what looks like a conninfo/URI
string. In back branches, just duplicate the same code all the way back
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.
In master, the routines are moved to src/common and renamed.
Author: David Fetter, Andrew Dunstan. Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.
Branch
------
REL9_1_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/276591bc4f2680485cd01626d87443b9c978e189
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 39 ++++++++++++++++-------
src/bin/psql/command.c | 69 ++++++++++++++++++++++++++++------------
src/bin/psql/common.c | 12 +++++++
src/bin/psql/common.h | 2 ++
src/bin/psql/help.c | 2 +-
src/bin/psql/tab-complete.c | 6 ++--
6 files changed, 96 insertions(+), 34 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* pgsql: psql: fix \connect with URIs and conninfo strings
@ 2015-04-01 23:10 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-01 23:10 UTC (permalink / raw)
To: pgsql-committers
psql: fix \connect with URIs and conninfo strings
psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.
Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments. Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.
There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts. Therefore this is backpatched all the way back to 9.0.
To implement this, routines previously private to libpq have been
duplicated so that psql can decide what looks like a conninfo/URI
string. In back branches, just duplicate the same code all the way back
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.
In master, the routines are moved to src/common and renamed.
Author: David Fetter, Andrew Dunstan. Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.
Branch
------
REL9_0_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/557fcfae3f1532d9f4c77ea36720477e535e86bb
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 39 ++++++++++++++++++-------
src/bin/psql/command.c | 63 +++++++++++++++++++++++++++++-----------
src/bin/psql/common.c | 12 ++++++++
src/bin/psql/common.h | 2 ++
src/bin/psql/help.c | 4 +--
src/bin/psql/tab-complete.c | 6 ++--
6 files changed, 94 insertions(+), 32 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
* pgsql: psql: fix \connect with URIs and conninfo strings
@ 2015-04-02 15:36 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 22+ messages in thread
From: Alvaro Herrera @ 2015-04-02 15:36 UTC (permalink / raw)
To: pgsql-committers
psql: fix \connect with URIs and conninfo strings
This is the second try at this, after fcef1617295 failed miserably and
had to be reverted: as it turns out, libpq cannot depend on libpgcommon
after all. Instead of shuffling code in the master branch, make that one
just like 9.4 and accept the duplication. (This was all my own mistake,
not the patch submitter's).
psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.
Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments. Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.
There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts. Therefore this is backpatched all the way back to 9.0.
Author: David Fetter, Andrew Dunstan. Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/e146ca682062ca1f5015f3820571c5359f5f9dba
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 40 +++++++++++++------
src/bin/psql/command.c | 79 ++++++++++++++++++++++++++-----------
src/bin/psql/common.c | 41 +++++++++++++++++++
src/bin/psql/common.h | 2 +
src/bin/psql/help.c | 4 +-
src/bin/psql/tab-complete.c | 11 ++++--
src/interfaces/libpq/fe-connect.c | 4 ++
7 files changed, 142 insertions(+), 39 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 22+ messages in thread
end of thread, other threads:[~2015-04-02 16:05 UTC | newest]
Thread overview: 22+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 01:29 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-02 01:58 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-02 02:36 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-02 02:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 02:56 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-02 13:42 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:01 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-04-02 14:19 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:38 ` Bruce Momjian <bruce@momjian.us>
2015-04-02 14:41 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 14:57 ` Bruce Momjian <bruce@momjian.us>
2015-04-02 15:06 ` Robert Haas <robertmhaas@gmail.com>
2015-04-02 16:05 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-01 23:10 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-04-02 15:36 pgsql: psql: fix \connect with URIs and conninfo strings Alvaro Herrera <alvherre@alvh.no-ip.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox