Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qpDoT-004ozu-1M for pgsql-docs@arkaria.postgresql.org; Sat, 07 Oct 2023 20:22:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qpDoP-001ffM-GQ for pgsql-docs@arkaria.postgresql.org; Sat, 07 Oct 2023 20:22:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qpDoP-001ffD-7x for pgsql-docs@lists.postgresql.org; Sat, 07 Oct 2023 20:22:10 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qpDoL-000ol4-1c for pgsql-docs@lists.postgresql.org; Sat, 07 Oct 2023 20:22:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 397KM1cn3179622; Sat, 7 Oct 2023 16:22:01 -0400 From: Tom Lane To: "David G. Johnston" cc: Kirk Parker , pgsql-docs@lists.postgresql.org Subject: Re: Typo in PL/pgSQL trigger Example 43.4? In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Sat, 07 Oct 2023 11:15:34 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3179620.1696710121.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 07 Oct 2023 16:22:01 -0400 Message-ID: <3179621.1696710121@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Sat, Oct 7, 2023 at 11:11=E2=80=AFAM Kirk Parker w= rote: >> INSERT INTO emp_audit SELECT 'D', now(), user, OLD.*; -- <=3D 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-IN= FO-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