Per database connection limit buglet

Lists: pgsql-bugs
From: "Dave Page" <dpage(at)pgadmin(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Per database connection limit buglet
Date: 2008-11-18 13:01:40
Message-ID: 937d27e10811180501k18e8aa5te98fededb8bf3892@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

It's possible to set a per-database connection limit of < -1, which seems bogus:

gator:~ dpage$ /usr/local/pgsql84/bin/psql -p 5433 postgres
psql (8.4devel)
Type "help" for help.

postgres=# create database test with connection limit = -999;
CREATE DATABASE
postgres=# select datname, datconnlimit from pg_database;
datname | datconnlimit
-----------+--------------
template1 | -1
template0 | -1
postgres | 50
foo | 45
test | -999
(5 rows)

8.3 seems similarly afflicted - I haven't tested any further back.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-26 12:26:05
Message-ID: 497DABDD.40906@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Dave Page wrote:
> It's possible to set a per-database connection limit of < -1, which seems bogus:

Yeah. That's simple to fix, but I'm having trouble wordsmithing the
error message. This is what I came up with:

invalid connection limit %d (must be -1, meaning no limit, or greater)

Any better suggestions?

I also note that you can set it to INT_MAX, while max_connections is
limited to INT_MAX/4, but I'm inclined to leave that alone.

> 8.3 seems similarly afflicted - I haven't tested any further back.

Hmm, I don't think this should be backported, since it doesn't cause any
actual problems. We'd just risk breaking people's scripts that use
-999 to mean "no limit". (they will be broken when they upgrade to 8.4
anyway, of course, but that's fine)

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Dave Page <dpage(at)pgadmin(dot)org>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-26 12:51:12
Message-ID: 937d27e10901260451l18531451wb2d6c0d142b69536@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Mon, Jan 26, 2009 at 12:26 PM, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> Dave Page wrote:
>>
>> It's possible to set a per-database connection limit of < -1, which seems
>> bogus:
>
> Yeah. That's simple to fix, but I'm having trouble wordsmithing the error
> message. This is what I came up with:
>
> invalid connection limit %d (must be -1, meaning no limit, or greater)
>
> Any better suggestions?

Perhaps drop the 'meaning no limit'? Less helpful perhaps (but that's
what the manual is for), but it sounds better

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


From: tomas(at)tuxteam(dot)de
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Dave Page <dpage(at)pgadmin(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-26 13:09:43
Message-ID: 20090126130943.GA13214@tomas
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Jan 26, 2009 at 02:26:05PM +0200, Heikki Linnakangas wrote:
> Dave Page wrote:
>> It's possible to set a per-database connection limit of < -1, which seems
>> bogus:
>
> Yeah. That's simple to fix, but I'm having trouble wordsmithing the error
> message. This is what I came up with:
>
> invalid connection limit %d (must be -1, meaning no limit, or greater)
>
> Any better suggestions?

Maybe

invalid connection limit %d (must be positive or -1, for "unlimited")

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD4DBQFJfbYXBcgs9XrR2kYRApUkAJ9V/aYLn37zyDeS7dqTwZqgLfqoVgCYokPR
52vaXe/OrDwdKFlN4vElSQ==
=XS2a
-----END PGP SIGNATURE-----


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: tomas(at)tuxteam(dot)de
Cc: Dave Page <dpage(at)pgadmin(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-26 13:16:37
Message-ID: 497DB7B5.50202@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

tomas(at)tuxteam(dot)de wrote:
> On Mon, Jan 26, 2009 at 02:26:05PM +0200, Heikki Linnakangas wrote:
>> Dave Page wrote:
>>> It's possible to set a per-database connection limit of < -1, which seems
>>> bogus:
>> Yeah. That's simple to fix, but I'm having trouble wordsmithing the error
>> message. This is what I came up with:
>>
>> invalid connection limit %d (must be -1, meaning no limit, or greater)
>>
>> Any better suggestions?
>
> Maybe
>
> invalid connection limit %d (must be positive or -1, for "unlimited")

Hmm, that sounds better, but it can also be 0.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: tomas(at)tuxteam(dot)de
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: tomas(at)tuxteam(dot)de, Dave Page <dpage(at)pgadmin(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-26 14:32:43
Message-ID: 20090126143243.GA13656@tomas
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Jan 26, 2009 at 03:16:37PM +0200, Heikki Linnakangas wrote:
[...]
>> Maybe
>> invalid connection limit %d (must be positive or -1, for "unlimited")
>
> Hmm, that sounds better, but it can also be 0.

Oops. "nonnegative", then. Creeping unreadability, again?

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJfcmLBcgs9XrR2kYRAtQRAKCCG5Zn6mKfzFJyRPeanH80t0a7HgCeL5r8
rzthpyajTrBYEppMnZFPeC4=
=NqZ9
-----END PGP SIGNATURE-----


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Dave Page <dpage(at)pgadmin(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-26 14:49:21
Message-ID: 20090126144921.GD3777@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Heikki Linnakangas wrote:
> Dave Page wrote:
>> It's possible to set a per-database connection limit of < -1, which seems bogus:
>
> Yeah. That's simple to fix, but I'm having trouble wordsmithing the
> error message. This is what I came up with:
>
> invalid connection limit %d (must be -1, meaning no limit, or greater)

Split it up:

errmsg("invalid connection limit %d"),
errdetail("Limit must be a non-negative number, or -1 for no limit.")

or maybe

errdetail("Valid values are -1 for no limit, or a non-negative number.")

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Dave Page <dpage(at)pgadmin(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-26 15:40:15
Message-ID: 10755.1232984415@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> Dave Page wrote:
>> It's possible to set a per-database connection limit of < -1, which seems bogus:

> Yeah. That's simple to fix, but I'm having trouble wordsmithing the
> error message. This is what I came up with:

Why does it need to be anything except GUC's standard "invalid value"
message? I really don't believe that this case is worth making
translators deal with an additional string.

regards, tom lane


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dave Page <dpage(at)pgadmin(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Per database connection limit buglet
Date: 2009-01-30 17:26:23
Message-ID: 4983383F.6010909@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
>> Dave Page wrote:
>>> It's possible to set a per-database connection limit of < -1, which seems bogus:
>
>> Yeah. That's simple to fix, but I'm having trouble wordsmithing the
>> error message. This is what I came up with:
>
> Why does it need to be anything except GUC's standard "invalid value"
> message? I really don't believe that this case is worth making
> translators deal with an additional string.

I guess. The message in guc.c seems a bit cumbersome, though, so I did
create a new message for it. It's now simply "invalid connection limit: %d".

The check was missing from per-user connection limits, fixed that too.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com