From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Mikhail Gribkov <youzhick(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, Ivan Panchenko <wao(at)mail(dot)ru>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
Subject: | Re: On login trigger: take three |
Date: | 2024-02-06 05:57:45 |
Message-ID: | CALj2ACWFUW4jX9EW7CLxbzSS+b7b0Z=xKYrqzj2Rstc9MCEx7g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Oct 16, 2023 at 6:36 AM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> > On Mon, Oct 16, 2023 at 02:47:03AM +0300, Alexander Korotkov wrote:
> > > The attached revision fixes test failures spotted by
> > > commitfest.cputube.org. Also, perl scripts passed perltidy.
>
> You are very fast and sharp eye!
> Thank you for fixing the indentation. I just pushed fixes for the rest.
I noticed some typos related to this feature.
While on this, the event trigger example for C programming language
shown in the docs doesn't compile as-is. fmgr.h is needed.
Please see the attached patch.
[1]
2024-02-06 05:31:24.453 UTC [1401414] LOG: tag LOGIN, event login
#include "postgres.h"
#include "commands/event_trigger.h"
#include "fmgr.h"
PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(onlogin);
Datum
onlogin(PG_FUNCTION_ARGS)
{
EventTriggerData *trigdata;
if (!CALLED_AS_EVENT_TRIGGER(fcinfo)) /* internal error */
elog(ERROR, "not fired by event trigger manager");
trigdata = (EventTriggerData *) fcinfo->context;
elog(LOG, "tag %s, event %s", GetCommandTagName(trigdata->tag),
trigdata->event);
PG_RETURN_NULL();
}
gcc -shared -fPIC -I /home/ubuntu/postgres/pg17/include/server -o
login_trigger.so login_trigger.c
LOAD '/home/ubuntu/postgres/login_trigger.so';
CREATE FUNCTION onlogin() RETURNS event_trigger
AS '/home/ubuntu/postgres/login_trigger' LANGUAGE C;
CREATE EVENT TRIGGER onlogin ON login
EXECUTE FUNCTION onlogin();
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fix-some-typos-in-event-trigger-docs.patch | application/octet-stream | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Masahiko Sawada | 2024-02-06 06:05:22 | Re: Improve eviction algorithm in ReorderBuffer |
Previous Message | Michael Paquier | 2024-02-06 05:56:24 | Re: GUC-ify walsender MAX_SEND_SIZE constant |