Re: Possible trigger bug? function call argument literalised - Mailing list pgsql-general

From Thiemo Kellner
Subject Re: Possible trigger bug? function call argument literalised
Date
Msg-id 20210103184529.Horde.LO8-skyriHu3oMxD4rNG2WV@webmail.gelassene-pferde.biz
Whole thread Raw
In response to Re: Possible trigger bug? function call argument literalised  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Possible trigger bug? function call argument literalised
List pgsql-general
Quoting Tom Lane <tgl@sss.pgh.pa.us>:

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

Oh, thanks! I did not read careful enough. I could not imagine such a  
behaviour to be intentional.

Well, I guess, I can put the correct schema at installation, but would  
have liked to have a more general approach. Furthermore, I think this  
also implies that installation can only be done by psql. :-s

-- 
S/MIME Public Key: https://oc.gelassene-pferde.biz/index.php/s/eJuAUFONag6ofnH
Signal (Safer than WhatsApp): +49 1578 7723737
Threema (Safer than WhatsApp): A76MKH3J
Handys: +41 78 947 36 21 | +49 1578 772 37 37




pgsql-general by date:

Previous
From: Thiemo Kellner
Date:
Subject: Re: Possible trigger bug? function call argument literalised
Next
From: Demitri Muna
Date:
Subject: Re: Getting "could not read block" error when creating an index on a function.