ETWEEN ARRAY['foo', 'bar'] AND ARRAY['foo', 'bar',
NULL]" approach works really fast (uses the index), and selects all arrays
that are equal to or start with ['foo', 'bar'].
Thanks everybody,
Denes Daniel
2009/12/7 Sam Mason
>
le.
Yes, I also think that an array prefix equality operator would be good to
have... but now that I've found it in the documentation that this solution
can be relied on (see my other mail), I can work around the lack of that.
Thanks,
Denes Daniel
I was sure I've read this part of the docs a hundred times, so I've gone
after why I didn't find this before: this note is new in the 8.4 docs, it
wasn't there before (and I'm using 8.3).
http://www.postgresql.org/docs/8.3/static/functions-comparisons.html#ROW-WISE-COMPARISON
But I'm pretty sure now that I can rely on this.
Thanks,
Denes Daniel
using an ARRAY[], and the other way when
using ROW()?
SELECT ARRAY['abc', 'string', 'z'] < ARRAY['abc', NULL::text, 'a'];
--> returns TRUE
SELECT ROW('abc', 'string', 'z') < ROW('abc', NULL::text, 'a');
--> returns NULL
Regards,
Denes Daniel
x27;
<= NULL) is NULL?
In fact, ('string' <= NULL) is NULL if I test it directly, or use row-wise
comparison, but when I use array comparison, NULL is greather than 'string'.
SELECT 'string' <= NULL::text, ARRAY['string'] <= ARRAY[NULL::text];
This gives me a NULL and a TRUE.
Why? Can I rely on this? If I can't, is there another way to make the array
prefix search use the index?
Regards,
Denes Daniel