Re: fallback_application_name and pgbench

Lists: pgsql-hackers
From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: fallback_application_name and pgbench
Date: 2010-04-03 20:29:06
Message-ID: z2n3f0b79eb1004031329lc1ff015em28d45928d9728646@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

By default, the application_name of pgbench is "[unknown]". But I think
that pgbench should use fallback_application_name as psql, pg_dump,
etc does. Is it worth creating the patch?

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


From: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fallback_application_name and pgbench
Date: 2010-04-07 08:21:58
Message-ID: 20100407172158.FCC7.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:

> By default, the application_name of pgbench is "[unknown]". But I think
> that pgbench should use fallback_application_name as psql, pg_dump,
> etc does. Is it worth creating the patch?

If we will take care of fallback_application_name for contrib modules,
we need to fix not only "pgbench" but also "oid2name" and "dblink".
I think those fixes would be worth; at least for telling third-party
developers to handle the new parameter.

It might be better to set fallback_application_name automatically
in libpq, but it requires argv[0] away from main() function.
GetModuleFilename() is available on Windows for the purpose,
but I don't know what API is available on other platforms.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fallback_application_name and pgbench
Date: 2010-04-07 09:16:02
Message-ID: w2g9837222c1004070216u3bc46b3ahbddfdffdbfb46212@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Apr 7, 2010 at 10:21, Takahiro Itagaki
<itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>
> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
>> By default, the application_name of pgbench is "[unknown]". But I think
>> that pgbench should use fallback_application_name as psql, pg_dump,
>> etc does. Is it worth creating the patch?
>
> If we will take care of fallback_application_name for contrib modules,
> we need to fix not only "pgbench" but also "oid2name" and "dblink".
> I think those fixes would be worth; at least for telling third-party
> developers to handle the new parameter.

Uh, why fallback_application_name? Isn't this the *exact* usecase
where "application_name" should be used? At least for the two apps -
fallback_app_name might be correct for dblink.

And yes, I think it's a good idea to set it for at least pgbench and oid2name.

> It might be better to set fallback_application_name automatically
> in libpq, but it requires argv[0] away from main() function.
> GetModuleFilename() is available on Windows for the purpose,
> but I don't know what API is available on other platforms.

I think that's a pretty bad idea in general. But if we do, then it
should at least never override something that's specified - we need to
keep the ability for tools like psql and pgadmin to set it, regardless
of what they happen to have as argv[0].

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: Dave Page <dpage(at)pgadmin(dot)org>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fallback_application_name and pgbench
Date: 2010-04-07 09:30:54
Message-ID: i2w937d27e11004070230i653498c8vb1f5f30a1b283bb7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Apr 7, 2010 at 10:16 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> Uh, why fallback_application_name? Isn't this the *exact* usecase
> where "application_name" should be used? At least for the two apps -
> fallback_app_name might be correct for dblink.
>
> And yes, I think it's a good idea to set it for at least pgbench and oid2name.

For pgbench, I can imagine scenarios where you might want to override
the name in a script - for example, if you're trying to simulate an
environment with multiple workload types running against the same
database.

> I think that's a pretty bad idea in general. But if we do, then it
> should at least never override something that's specified - we need to
> keep the ability for tools like psql and pgadmin to set it, regardless
> of what they happen to have as argv[0].

We discussed that during the development of the patch - the original
idea was to default to argv[0] if no other value was set, but
apparently there's no portable way to get at argv[0] from within
libpq, even if you ignore Windows.

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


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fallback_application_name and pgbench
Date: 2010-04-07 12:05:58
Message-ID: j2o603c8f071004070505rc6dd5edaxa5a3e2a64afda676@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Apr 7, 2010 at 5:30 AM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
> On Wed, Apr 7, 2010 at 10:16 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>> Uh, why fallback_application_name? Isn't this the *exact* usecase
>> where "application_name" should be used? At least for the two apps -
>> fallback_app_name might be correct for dblink.
>>
>> And yes, I think it's a good idea to set it for at least pgbench and oid2name.
>
> For pgbench, I can imagine scenarios where you might want to override
> the name in a script - for example, if you're trying to simulate an
> environment with multiple workload types running against the same
> database.

Agreed.

>> I think that's a pretty bad idea in general. But if we do, then it
>> should at least never override something that's specified - we need to
>> keep the ability for tools like psql and pgadmin to set it, regardless
>> of what they happen to have as argv[0].
>
> We discussed that during the development of the patch - the original
> idea was to default to argv[0] if no other value was set, but
> apparently there's no portable way to get at argv[0] from within
> libpq, even if you ignore Windows.

That's true, and I also agree with Magnus's commenet that it's a bad
idea anyway.

...Robert