Re: How to tell which statement is being executed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Garfield Lewis <garfield(dot)lewis(at)lzlabs(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to tell which statement is being executed
Date: 2023-11-03 16:08:29
Message-ID: 3307593.1699027709@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Garfield Lewis <garfield(dot)lewis(at)lzlabs(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message shashidhar Reddy 2023-11-03 17:40:45 Finding execution plan
Previous Message Garfield Lewis 2023-11-03 14:58:18 How to tell which statement is being executed