Re: DROP DATABASE always seeing database in use

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jens-Wolfhard Schicke" <drahflow(at)gmx(dot)de>, "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DROP DATABASE always seeing database in use
Date: 2008-08-05 18:17:57
Message-ID: 603c8f070808051117y6f6e5f28i5665d41ea91b50f9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Maybe put the whole thing into the ERROR message instead of having a
separate DETAIL line?

ERROR: database "%s" is being accessed by %d session(s)
-or-
ERROR: database "%s'" is being accessed by %d prepared transaction(s)
-or-
ERROR: database "%s'" is being accessed by %d session(s) and %d
prepared transaction(s)

or possibly similar variants on the following, slightly more compact wording:

ERROR: database "%s'" has %d open session(s) and %d prepared transaction(s)

...Robert

On Tue, Aug 5, 2008 at 1:41 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Jens-Wolfhard Schicke <drahflow(at)gmx(dot)de> writes:
>> Tom Lane wrote:
>>> ERROR: database "%s" is being accessed by other users
>>> DETAIL: There are %d session(s) and %d prepared transaction(s) using the database.
>>>
>>> I'm aware that this phrasing might not translate very nicely ... anyone
>>> have a suggestion for better wording?
>
>> I can only estimate translation effort into German, but how about:
>
>> DETAIL: Active users of the database: %d session(s), %d prepared transaction(s)
>
> Hmmm ... what I ended up committing was code that special-cased the
> common cases where you only have one or the other, ie
>
> /*
> * We don't worry about singular versus plural here, since the English
> * rules for that don't translate very well. But we can at least avoid
> * the case of zero items.
> */
> if (notherbackends > 0 && npreparedxacts > 0)
> errdetail("There are %d other session(s) and %d prepared transaction(s) using the database.",
> notherbackends, npreparedxacts);
> else if (notherbackends > 0)
> errdetail("There are %d other session(s) using the database.",
> notherbackends);
> else
> errdetail("There are %d prepared transaction(s) using the database.",
> npreparedxacts);
>
> Your proposal seems fine for the first case but a bit stilted for the
> other two. Or maybe that's just me.
>
> Of course, we don't *have* to do it as above at all, if "0 prepared
> transactions" doesn't bother people.
>
> Ideas anybody?
>
> regards, tom lane
>
> --
> 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
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-08-05 18:20:40 Re: Why we don't panic in PageGetExactFreeSpace
Previous Message Zdenek Kotala 2008-08-05 17:42:53 Why we don't panic in PageGetExactFreeSpace