pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Kirk Parker <khp@equatoria.us>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Typo in PL/pgSQL trigger Example 43.4?
Date: Sat, 07 Oct 2023 16:22:01 -0400
Message-ID: <3179621.1696710121@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZW2qTAavt8R1c20wW_OOn9YZ9Eoz4oc8jy3+Y2en0keQ@mail.gmail.com>
References: <CAA_1=909ZR0ofmS5_JKonYwf+AdrU4_wojm5ckaB50s2EibzpQ@mail.gmail.com>
	<ZSBgYzT3vh7YOsew@momjian.us>
	<CANwZ8rmN_Eb0h0hoMRS8Feftaik0z89PxVsKg+cP+PctuOq=Qg@mail.gmail.com>
	<CAKFQuwZW2qTAavt8R1c20wW_OOn9YZ9Eoz4oc8jy3+Y2en0keQ@mail.gmail.com>

"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





view thread (6+ messages)  latest in thread

Message-ID: <3179621.1696710121@sss.pgh.pa.us>
Permalink:  ../3179621.1696710121@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3179621.1696710121@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, khp@equatoria.us, pgsql-docs@lists.postgresql.org
  Subject: Re: Typo in PL/pgSQL trigger Example 43.4?
  In-Reply-To: <3179621.1696710121@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox