There is no such feature and no viable workarounds.
An infeasible workaround is to construct a special stored procedure specifically for performing the INSERT(s), but that is not a general solution as the INSERT command takes a variable number of parameters (not least of which is which columns and data to populate with), while the stored procedure must have a fixed number of parameters.
If there existed a SQL function that would return a special session ID that corresponded to the client's transient connection to the SQL engine, it would be possible to have the client and trigger/stored procedure communicate using a pre-determined table as a request queue (by using the session ID as a key). Unfortunately, according to the documentation there is no such session ID.
The underlying use case for my question was for a way of implementing auto-incrementing primary keys on INSERTs that would communicate back to the client the inserted ID, so that I would not have to force the client to either
- provide an immediate value for the PK themselves
- provide a sequence that corresponds to the table that they are updating
Unfortunately, due to the lack of support, I've had to impose restrictions on the client to provide either one of the above (and lacking either, the code assumes a sequence of <tablename>_id_seq
exists).