pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Garfield Lewis <garfield.lewis@lzlabs.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: How to tell which statement is being executed
Date: Fri, 03 Nov 2023 12:08:29 -0400
Message-ID: <3307593.1699027709@sss.pgh.pa.us> (raw)
In-Reply-To: <AM8PR05MB825745F8A78FDB189A3F4AC7E3A5A@AM8PR05MB8257.eurprd05.prod.outlook.com>
References: <AM8PR05MB825745F8A78FDB189A3F4AC7E3A5A@AM8PR05MB8257.eurprd05.prod.outlook.com>

Garfield Lewis <garfield.lewis@lzlabs.com> writes:
> If I create a C function, is there a way from within that function for me to:
>   1.  know whether it is being triggered by an INSERT or UPDATE statement

It might not be any of those.  But if what you want is the most closely
nested SQL action, inspecting the ActivePortal might help (see
function_parse_error_transpose, which I think is the only in-core user).

>   2.  column attribute (specifically the TYPMOD) for the affected column

No.  How would you even define "affected column"?

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <3307593.1699027709@sss.pgh.pa.us>
Permalink:  ../3307593.1699027709@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3307593.1699027709@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, garfield.lewis@lzlabs.com
  Subject: Re: How to tell which statement is being executed
  In-Reply-To: <3307593.1699027709@sss.pgh.pa.us>
  References: <AM8PR05MB825745F8A78FDB189A3F4AC7E3A5A@AM8PR05MB8257.eurprd05.prod.outlook.com> <3307593.1699027709@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