On Feb 20, 2008, at 5:51 PM, Postgres User wrote:
Now to end my fixation, one last item. What about the case of a null
or empty param value- is there a way to assign a condition value that
Postgres will ignore when processing the query?
This syntax results in a seq scan: WHERE fielda = Coale
Tom,
I was looking for another approach but didn't come across that array
syntax in my searches (perhaps because it's newer. Thanks for a
solution.
Now to end my fixation, one last item. What about the case of a null
or empty param value- is there a way to assign a condition value that
Postgres
"Postgres User" <[EMAIL PROTECTED]> writes:
> My users are developers and the goal was to accept a simple
> comma-delimited list of string values as a function's input parameter.
> The function would then parse this input param into a valid regex
> expression.
Why are you fixated on this being a
Tino,
My users are developers and the goal was to accept a simple
comma-delimited list of string values as a function's input parameter.
The function would then parse this input param into a valid regex
expression.
I was trying to write a function that lets me avoid using Execute
and instead wr
Postgres User wrote:
im trying to allow the client to pass a varchar param into my
function, and want to avoid any parsing of the parameter inside the
function, or code to build a sql string.
if the function can use this code, it will be compiled and optimized
(unlike a dynamic sql stirng)
sele
On Wed, Feb 20, 2008 at 12:56:54AM -0800, Postgres User wrote:
> a final question: why does this syntax do a seq scan + filter:
>
> select * from tablea where fielda = fielda -or- select * from
> tablea where fielda in (fielda)
>
> while this syntax results in no filter, seq scan only
>
> sel
a final question: why does this syntax do a seq scan + filter:
select * from tablea where fielda = fielda -or- select * from
tablea where fielda in (fielda)
while this syntax results in no filter, seq scan only
select * from tablea where 1 = 1
it seems that both where clauses should be ignor
Postgres User wrote:
by the way, your example works fine unless it's a null value or empty string
unfortunately, postgres isn't smart enough to know that the when
p_param below is null, that the WHERE condition can be ignored
select * from table where name in (Coalesce(p_param, name))
which is
by the way, your example works fine unless it's a null value or empty string
unfortunately, postgres isn't smart enough to know that the when
p_param below is null, that the WHERE condition can be ignored
select * from table where name in (Coalesce(p_param, name))
which is the same as: select *
doh! tom, let me know if you decide to hack out a fix for this one of
these nights ;)
thanks for your help.
On Feb 19, 2008 9:45 PM, Tom Lane <[EMAIL PROTECTED]> wrote:
> "Postgres User" <[EMAIL PROTECTED]> writes:
> > Yes that works, but the whole point of the exercise is replace many OR
> > sta
"Postgres User" <[EMAIL PROTECTED]> writes:
> Yes that works, but the whole point of the exercise is replace many OR
> statements with 1 regex expression. So it's not what I'm looking for.
Unfortunately, Postgres is not as intelligent as you are. There is
no mechanism to rewrite a multi-branch r
im trying to allow the client to pass a varchar param into my
function, and want to avoid any parsing of the parameter inside the
function, or code to build a sql string.
if the function can use this code, it will be compiled and optimized
(unlike a dynamic sql stirng)
select * from mytable where
Postgres User wrote:
Yes that works, but the whole point of the exercise is replace many OR
statements with 1 regex expression. So it's not what I'm looking for.
Why do you want it done this way?
You can build an array of strings to check and use an in clause.
Using php :
$checks = array('A
Yes that works, but the whole point of the exercise is replace many OR
statements with 1 regex expression. So it's not what I'm looking for.
On Feb 19, 2008 9:16 PM, Chris <[EMAIL PROTECTED]> wrote:
> Postgres User wrote:
> > Thanks, my dumb mistake.
> > I need to perform the equivalent of a WHER
Postgres User wrote:
Thanks, my dumb mistake.
I need to perform the equivalent of a WHERE clause OR expression using
regex to match exact strings.
_
this example hits the index:
select * from eod where name ~ '^BA$'
but wh
Thanks, my dumb mistake.
I need to perform the equivalent of a WHERE clause OR expression using
regex to match exact strings.
_
this example hits the index:
select * from eod where name ~ '^BA$'
but when I try to add another
On Feb 19, 2008, at 9:32 PM, Postgres User wrote:
I'm running a simple query on 8.2. With this syntax, Explain indicate
that the index is scanned:
select * from eod where name = 'AA'
However, when I change the query to use simple regex:
select * from eod where name ~ 'AA'
now Explain indicate
I'm running a simple query on 8.2. With this syntax, Explain indicate
that the index is scanned:
select * from eod where name = 'AA'
However, when I change the query to use simple regex:
select * from eod where name ~ 'AA'
now Explain indicates a seq scan:
Index Scan using equity_eod_symbol_idx
18 matches
Mail list logo