On Thu, Oct 19, 2017 at 8:21 AM, Igal @ Lucee.org <i...@lucee.org> wrote:

> Is it still true (the posts I see on this subject are quite old) that I
> can not do so in Postgres outside of a stored procedure/function?  And if
> so, what's the reason of not adding this feature?  Seems very useful to me.
>
​<not positive on syntax but the concept should be sound>​

​PREPARE sqlquery AS​ SELECT * FROM products WHERE col1 LIKE $1 OR col2
LIKE $1;
EXECUTE sqlquery('red widget');

Alban's DO blocks are problematic since they are incapable of generating a
result set.

As Scott said people needing this functionality in PostgreSQL are content
with using psql.

Adding lots of new custom syntax to pure server-side parsed SQL is a
non-trivial undertaking whose need is reduced by the alternatives so
described (functions, DO block, PREPARE, psql).

David J.

Reply via email to