Re: Typo in PL/pgSQL trigger Example 43.4? - Mailing list pgsql-docs

From Tom Lane
Subject Re: Typo in PL/pgSQL trigger Example 43.4?
Date
Msg-id 3179621.1696710121@sss.pgh.pa.us
Whole thread Raw
In response to Re: Typo in PL/pgSQL trigger Example 43.4?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Typo in PL/pgSQL trigger Example 43.4?
Re: Typo in PL/pgSQL trigger Example 43.4?
List pgsql-docs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Sat, Oct 7, 2023 at 11:11 AM Kirk Parker <khp@equatoria.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.

            regards, tom lane



pgsql-docs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Typo in PL/pgSQL trigger Example 43.4?
Next
From: Kirk Parker
Date:
Subject: Re: Typo in PL/pgSQL trigger Example 43.4?