Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] psql commandline conninfo

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] psql commandline conninfo
Date: 2006-12-17 03:47:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
I assume this patch will still allow a database name with an equals
sign, right?

	psql "dbname='a=b'"

The libpq documentation isn't clear that single-quotes also escape
equals, but I assume that is true looking at the code:
	The passed string can be empty to use all default parameters, or it can
	contain one or more parameter settings separated by whitespace. Each
	parameter setting is in the form keyword = value. Spaces around the
	equal sign are optional. To write an empty value or a value containing
	spaces, surround it with single quotes, e.g., keyword = 'a value'.
	Single quotes and backslashes within the value must be escaped with a
	backslash, i.e., \' and \\.


Andrew Dunstan wrote:
> Andrew Dunstan wrote:
> > Tom Lane wrote:
> >> "Andrew Dunstan" <andrew(at)dunslane(dot)net> writes:
> >>
> >>> We change libpq from time to time. Besides, how many DBs are there that
> >>> match the name pattern /^conn:.*=/ ? My guess is mighty few. So I don't
> >>> expect lots of surprise.
> >>>
> >>
> >> Um, but how many DB names have an "=" in them at all?
> >>
> >> Basically what this proposal is about is migrating from separated
> >> dbname/user/host/port/etc parameters to a unified conninfo parameter.
> >> That seems to me like a good long-term objective, and so I'm willing
> >> to break a few eggs on the way to the omelet, as long as we're not
> >> breaking any very likely usages.
> >>
> >> So: who here has a database with "=" in the name?  And hands up if
> >> you've got a database whose name begins with "conn:"?
> >>
> >> I'm betting zero response rate on both of those, so see no reason to
> >> contort the long-term definition for a very marginal difference in
> >> the extent of backwards compatibility ...
> >>
> >>
> >>
> >
> > I'm not sure -hackers is the most representative group to poll regarding
> > dbnames in use ...
> >
> > Anyway, if I understand your current position, the only change needed to
> > my current patch would be that if we fail to parse a dbname parameter
> > that contains an = we simply fail at that point, rather than retrying it
> > as a straight database name.
> >
> > I'm OK with that.
> >
> Here's the patch for what I think is the consensus position. If there's no
> objection I will apply this and document it.
> cheers
> andrew

[ Attachment, skipping... ]

> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match

  Bruce Momjian   bruce(at)momjian(dot)us

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

In response to


pgsql-hackers by date

Next:From: Joshua D. DrakeDate: 2006-12-17 04:46:03
Subject: Re: development environment of postgres
Previous:From: dakotali kasapDate: 2006-12-17 00:47:40
Subject: development environment of postgres

pgsql-patches by date

Next:From: Andrew DunstanDate: 2006-12-17 06:22:46
Subject: Re: [PATCHES] psql commandline conninfo
Previous:From: Tom LaneDate: 2006-12-16 15:38:40
Subject: Re: [HACKERS] psql commandline conninfo

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group