pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thiemo Kellner <thiemo@gelassene-pferde.biz>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Possible trigger bug? function call argument literalised
Date: Sun, 03 Jan 2021 12:37:32 -0500
Message-ID: <2692292.1609695452@sss.pgh.pa.us> (raw)
In-Reply-To: <20210103180840.Horde.Fe4qNP3Uviz_9c6aPfxBTS2@webmail.gelassene-pferde.biz>
References: <20210103180840.Horde.Fe4qNP3Uviz_9c6aPfxBTS2@webmail.gelassene-pferde.biz>

Thiemo Kellner <thiemo@gelassene-pferde.biz> writes:
> create trigger CALCULATION_METHOD_BR_IU
>    before insert on CALCULATION_METHOD
>    for each row
>    execute function METHOD_CHECK(current_schema);

> Executing such, the string "current_schema" gets literalised, i.e.  
> single quoted:

Yup, per the CREATE TRIGGER documentation [1]:

    arguments

    An optional comma-separated list of arguments to be provided to the
    function when the trigger is executed. The arguments are literal
    string constants. Simple names and numeric constants can be written
    here, too, but they will all be converted to strings. Please check the
    description of the implementation language of the trigger function to
    find out how these arguments can be accessed within the function; it
    might be different from normal function arguments.

> I strongly feel this is a bug,

It's operating as designed.  There might be scope for a feature
improvement here, but it'd be a far-from-trivial task, with probably
a lot of ensuing compatibility breakage.

			regards, tom lane

[1] https://www.postgresql.org/docs/current/sql-createtrigger.html





view thread (14+ messages)  latest in thread

Message-ID: <2692292.1609695452@sss.pgh.pa.us>
Permalink:  ../2692292.1609695452@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2692292.1609695452@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, thiemo@gelassene-pferde.biz
  Subject: Re: Possible trigger bug? function call argument literalised
  In-Reply-To: <2692292.1609695452@sss.pgh.pa.us>
  References: <20210103180840.Horde.Fe4qNP3Uviz_9c6aPfxBTS2@webmail.gelassene-pferde.biz> <2692292.1609695452@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