Re: Typo in PL/pgSQL trigger Example 43.4?

From: Kirk Parker <khp(at)equatoria(dot)us>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Typo in PL/pgSQL trigger Example 43.4?
Date: 2023-10-09 04:36:36
Message-ID: CANwZ8r=e47NDGBrqG2jSp=-vMgBNJONQjYc=kvppVEUQyY84Rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sat, Oct 7, 2023 at 1:22 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Sat, Oct 7, 2023 at 11:11 AM Kirk Parker <khp(at)equatoria(dot)us> wrote:
> >> INSERT INTO emp_audit SELECT 'D', now(), user, OLD.*; -- <= ARGUMENT IN
> QUESTION
> >> The emp_audit table has a column named 'userid', which in actual usage
> >> (next-to-last line quoted) is populated by 'user' which seems undefined
> in
> >> the context. Was that intended to be 'current_user', or am I missing
> >> something?
>
> > user is a valid pseudo-function:
> >
> https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-SESSION
>
> Yeah, either way has the same result. However, I wonder if we should
> change this example to use current_user for clarity. It does look
> more like it's intended to be a variable or column reference than
> a built-in function.
>
>
Since the previous example on the page uses 'current_user' (which I
suppose is why I didn't look further to see if 'user' was also a function),
perhaps that would be a good idea.

>
>

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Daniel Gustafsson 2023-10-09 08:53:07 Re: Typo in PL/pgSQL trigger Example 43.4?
Previous Message Tom Lane 2023-10-07 20:22:01 Re: Typo in PL/pgSQL trigger Example 43.4?