Search Postgresql Archives

Re: [EXT] Re: How to tell which statement is being executed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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).

 

Thx, Tom… will see if this ActivePortal helps…

 

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

Not sure I just assumed that the attributes for column being processed would be saved somewhere in some structure somewhere. After all, at some point if for instance I created a CHAR(10) column and attempted to insert a CHAR(15) that is returned by my function then Postgres will need to generate a truncation warning so it must know the TYPMOD of the column to do so.

 

Regards

Garfield

 

From: Tom Lane <tgl@xxxxxxxxxxxxx>
Date: Friday, November 3, 2023 at 12:08 PM
To: Garfield Lewis <garfield.lewis@xxxxxxxxxx>
Cc: pgsql-generallists.postgresql.org <pgsql-general@xxxxxxxxxxxxxxxxxxxx>
Subject: [EXT] Re: How to tell which statement is being executed

Garfield Lewis <garfield.lewis@xxxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux