Re: Strange behaviour on function

2023-07-05 Thread Lorusso Domenico
Erik, Adrian, The trigger function is very long and complex (and not yet well documented), but bind_action is a normal function callable everywhere, the problem as discovered by Erik was in the null value contained in the hstore. Anyway, when the ecosystem of functions will work correctly I can s

Re: Strange behaviour on function

2023-07-05 Thread Lorusso Domenico
yes!! I solved using quote_nullable on hrec[k]. I was convinced string || NULL --> string but I'm wrong. Thanks!! Il giorno mer 5 lug 2023 alle ore 15:53 Erik Wienhold ha scritto: > > On 05/07/2023 14:23 CEST Lorusso Domenico > wrote: > > > > Hello guys, > > here a simple function > > > >

Re: Strange behaviour on function

2023-07-05 Thread Erik Wienhold
> On 05/07/2023 17:16 CEST Adrian Klaver wrote: > > https://www.postgresql.org/docs/current/plpgsql-trigger.html > > 1) > "A trigger function must return either NULL or a record/row value having > exactly the structure of the table the trigger was fired for." > > 2) I am not seeing where you use:

Re: Strange behaviour on function

2023-07-05 Thread Adrian Klaver
On 7/5/23 05:23, Lorusso Domenico wrote: Hello guys, here a simple function CREATE OR REPLACE FUNCTION bind_action( sqlstr text, hrec hstore)     RETURNS text     LANGUAGE 'plpgsql'     COST 100     immutable PARALLEL SAFE AS $BODY$ declare _sqlstr text=sqlstr; _k text; _debug text; begin _d

Re: Strange behaviour on function

2023-07-05 Thread Erik Wienhold
> On 05/07/2023 14:23 CEST Lorusso Domenico wrote: > > Hello guys, > here a simple function > > CREATE OR REPLACE FUNCTION bind_action( > sqlstr text, > hrec hstore) > RETURNS text > LANGUAGE 'plpgsql' > COST 100 > immutable PARALLEL SAFE > AS $BODY$ > declare > _sqlstr text=sqlstr; > _k t