How to tell which statement is being executed - Mailing list pgsql-general

From Garfield Lewis
Subject How to tell which statement is being executed
Date
Msg-id AM8PR05MB825745F8A78FDB189A3F4AC7E3A5A@AM8PR05MB8257.eurprd05.prod.outlook.com
Whole thread Raw
Responses Re: How to tell which statement is being executed  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general

Hi All,

 

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
    1. I’ve done some digging and it seems you can get this information if you provide a Planner hook, however, I need to know this much later in my function not in the Planner
    2. Is there some way for me to get to the PlannedStmt (or anything else that may have the command type) from within my function?
  2. column attribute (specifically the TYPMOD) for the affected column

 

BTW, is there a more appropriate Postgres list/group/blog that is specifically dedicated to these types of programming questions or is it ok to post this here?

 

Regards,

Garfield

pgsql-general by date:

Previous
From: Philip Semanchuk
Date:
Subject: Re: Local postgres manual
Next
From: Tom Lane
Date:
Subject: Re: How to tell which statement is being executed