Curtis Scheer wrote:
> I noticed this one by searching in the archives, as I am working with
some
> "optional" parameters myself and noticed your solution. I just wanted to
> make one improvement suggestion which is instead of checking whether
or not
> a parameter has been used simply start yo
: Thursday, August 17, 2006
8:58 PM
To: MaXX
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help with
optional parameters
BEGIN
query_base := 'SELECT * FROM my_table ';
has_param := FALSE;
query_where := '';
IF (a IS NOT NULL) THEN
IF (has_param IS FALSE)THEN
-- t
This seems to be the best solution. At first I was a bit skeptical about the perfomance using execute versus using pre-planned queries. However, I found that this model actually executes faster than the paramterized queries that I was trying (even using the if-then-endif model).
Thanks for this
Rob Tester wrote:
I have the need to have optional values for a query in a stored procedure
that I am building. (using postgres 8.1.4). This particular query
executes
against a huge table (several million rows) and has six optional
parameters
that can be sent to the function. If one of the para
On Wed, Aug 16, 2006 at 08:39:49PM -0700, Rob Tester wrote:
> What is the best way to write a query and get the planner to use indexes
> when you have optional parameters and columns that can contain NULL values?
Have you considered building a query string and using EXECUTE?
That's not as "neat" a
I have the need to have optional values for a query in a stored procedure that I am building. (using postgres 8.1.4). This particular query executes against a huge table (several million rows) and has six optional parameters that can be sent to the function. If one of the parameters is null then th