On 2006-02-01, rlee0001 <[EMAIL PROTECTED]> wrote:
> Stephan,
>
> How do IN and NOT IN treat NULLs? Don't these functions search an array
> for a specified value returning true or false? I guess the intuitive
> thing for IN and NOT IN to do would be to return NULL if NULL appears
> anywhere in the
On Wed, 1 Feb 2006, rlee0001 wrote:
> How do IN and NOT IN treat NULLs? Don't these functions search an array
> for a specified value returning true or false? I guess the intuitive
> thing for IN and NOT IN to do would be to return NULL if NULL appears
> anywhere in the array since those elements
Stephan,
How do IN and NOT IN treat NULLs? Don't these functions search an array
for a specified value returning true or false? I guess the intuitive
thing for IN and NOT IN to do would be to return NULL if NULL appears
anywhere in the array since those elements values are "unknown".
Personally I
On Tue, 31 Jan 2006, rlee0001 wrote:
> I am suggesting that the behaviour of SUBSTRING returning NULL when no
> matches is found is either a bug in PostgreSQL or a flaw in the SQL
> specification. It is not logical.
No, but sadly it seems to be what the SQL spec wants for its similar
construct.
"rlee0001" <[EMAIL PROTECTED]> writes:
> My problem is with SUBSTRING. When it fails to find a match for the
> regexp pattern within the source string it returns NULL. Why?!
Because the SQL standard says so.
Of course, you're free to wrap the built-in function in your own
function that has behavi
Martijn,
(Warning: This post contains somewhat of a long rant followed by a
question.)
I realize that NULL is the unknown value in SQL and that (most)
functions therefore treat it as such. I have no problem with "RETURNS
NULL ON NULL INPUT" except when a function returns NULL for no good
reason.
On Tue, 31 Jan 2006, Martijn van Oosterhout wrote:
> On Mon, Jan 30, 2006 at 11:27:23AM -0800, rlee0001 wrote:
> > The problem was that SUBSTRING returns NULL if it cannot find any
> > matches for the pattern and when the second parameter to REPLACE
> > returns NULL, REPLACE returns NULL (which i
On Mon, 30 Jan 2006, rlee0001 wrote:
> I did get the code working. The function DDL follows:
>
> CREATE OR REPLACE FUNCTION "webadmin"."regexp_replacex" (source
> varchar, pattern varchar, replacement varchar) RETURNS varchar AS
> $body$
> DECLARE
> retvalue VARCHAR;
> BEGIN
> retvalue = "sourc
On Mon, Jan 30, 2006 at 11:27:23AM -0800, rlee0001 wrote:
> The problem was that SUBSTRING returns NULL if it cannot find any
> matches for the pattern and when the second parameter to REPLACE
> returns NULL, REPLACE returns NULL (which is idiotic). Using COALESCE I
> ensure that is SUBSTRING canno
"rlee0001" <[EMAIL PROTECTED]> writes:
> CREATE OR REPLACE FUNCTION "regexp_replacex" (source varchar, pattern
> varchar, replacement varchar) RETURNS varchar AS
> $body$
> DECLARE
> retvalue VARCHAR;
> BEGIN
> retvalue = "source";
> LOOP
> retvalue = REPLACE(retvalue, SUBSTRING(retvalue FROM
I did get the code working. The function DDL follows:
CREATE OR REPLACE FUNCTION "webadmin"."regexp_replacex" (source
varchar, pattern varchar, replacement varchar) RETURNS varchar AS
$body$
DECLARE
retvalue VARCHAR;
BEGIN
retvalue = "source";
LOOP
retvalue = REPLACE(retvalue, COALESCE(SUBSTR
I have a stupid problem. My server is running an old version of
postgres (8.0.3) and therefore lacks the regexp_replace() function. It
does however support substring and replace functions. So what I am
trying to do is emulate the regexp_replace() function by creating a
function which finds each mat
12 matches
Mail list logo