Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Thiemo Kellner
On 02/16/18 14:47, Thiemo Kellner, NHC Barhufpflege wrote: Thanks for answering. Zitat von Pavel Stehule : Why you don't create query like EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y'  USING NEW; I shall try. This would be the direct way, but I doubt the placeholder $1 can be

RE: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Igor Neyman
Hi all I would like to have a generic trigger function that compares on insert if there is already a record in the table with the very same values. Using PL/pgSQL ( I am not bound to that) I know the insert record structure from the new record and I can build a select query dynamically from the

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Thiemo Kellner
Zitat von Daniel Verite : Thiemo Kellner, NHC Barhufpflege wrote: > Why you don't create query like > > EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y' USING NEW; I shall try. This would be the direct way, but I doubt the placeholder $1 can be a record. It could be writte

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Daniel Verite
Thiemo Kellner, NHC Barhufpflege wrote: > > Why you don't create query like > > > > EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y' USING NEW; > > I shall try. This would be the direct way, but I doubt the placeholder > $1 can be a record. It could be written without referin

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Thiemo Kellner, NHC Barhufpflege
Thanks for answering. Zitat von Pavel Stehule : Why you don't create query like EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y' USING NEW; I shall try. This would be the direct way, but I doubt the placeholder $1 can be a record. I don't understand tou your case, but usually

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Pavel Stehule
Hi 2018-02-16 13:20 GMT+01:00 Thiemo Kellner : > Hi all > > I would like to have a generic trigger function that compares on insert if > there is already a record in the table with the very same values. Using > PL/pgSQL ( I am not bound to that) I know the insert record structure from > the new r