Re: Adding the extension name to EData / log_line_prefix

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Adding the extension name to EData / log_line_prefix
Date: 2024-05-13 23:28:03
Message-ID: pcicxvh23yvw5ys4g5iuqpku26cv6hjau5tgepvjqkx45zwoh5@brttsdclx6gt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 13, 2024 at 07:11:53PM GMT, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2024-05-13 19:25:11 -0300, Fabrízio de Royes Mello wrote:
> >> Hmmm, depending on the extension it can extensively call/use postgres code
> >> so would be nice if we can differentiate if the code is called from
> >> Postgres itself or from an extension.
>
> > I think that's not realistically possible. It's also very fuzzy what that'd
> > mean. If there's a planner hook and then the query executes normally, what do
> > you report for an execution time error? And even the simpler case - should use
> > of pg_stat_statements cause everything within to be logged as a
> > pg_stat_statement message?
>
> Not to mention that there could be more than one extension on the call
> stack. I think tying this statically to the ereport call site is
> fine.
>
> The mechanism that Andres describes for sourcing the name seems a bit
> overcomplex though. Why not just allow/require each extension to
> specify its name as a constant string? We could force the matter by
> redefining PG_MODULE_MAGIC as taking an argument:
>
> PG_MODULE_MAGIC("hstore");

FTR there was a proposal at [1] some time ago that could be used for that need
(and others), I thought it could be good to mention it just in case. That
would obviously only work if all extensions uses that framework.

[1] https://www.postgresql.org/message-id/flat/3207907.AWbSqkKDnR%40aivenronan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-05-13 23:29:18 Re: Why is parula failing?
Previous Message Andres Freund 2024-05-13 23:27:53 Re: Adding the extension name to EData / log_line_prefix