From: | Melvin Call <melvincall979(at)gmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Passing a WHERE clause by trigger to a function |
Date: | 2013-06-04 13:09:23 |
Message-ID: | CADGQN57Tvw-fwF4uDoAV_httOODPUPbqYoDvmfxU66vyAo44qQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ah, just create user-defined functions that take the ID as a parameter and
have the user call them, instead of a trigger function, eh? I think I like
that better because I can then have separate update and delete functions,
with descriptive names. I can do that, and I guess I was looking at this
the wrong way. Thanks a million!
On Tue, Jun 4, 2013 at 7:47 AM, David Johnston <polobo(at)yahoo(dot)com> wrote:
> Melvin Call wrote
> > But I still have a question in that I'd like to know if I can pass the
> > WHERE clause to the function so it can examine the query? Or will I have
> > to
> > test for the potential of acting on more than one row?
>
> You can write a function that takes a text/varchar and builds a dynamic SQL
> query that then is executed...but I highly advise against it. Basically you
> open yourself to SQL injection attack vectors and passing in a where clause
> to a function is a very non-intuitive and cumbersome API.
>
> What you likely want are functions that do what you want and take a person
> id as an input. Let the user decide the best way to obtain that person id.
>
> David J.
>
>
>
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/Passing-a-WHERE-clause-by-trigger-to-a-function-tp5757825p5757877.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Mads.Tandrup | 2013-06-04 13:25:47 | Streaming replication with sync slave, but disconnects due to missing WAL segments |
Previous Message | Andres Freund | 2013-06-04 13:04:06 | Re: More buffers used than a relation's relpages |