Part 2 of "Intentional, or a bug".... - Mailing list pgsql-sql

From Kovacs Baldvin
Subject Part 2 of "Intentional, or a bug"....
Date
Msg-id Pine.GSO.4.33.0109162349570.1893-100000@ural2
Whole thread Raw
Responses Re: Part 2 of "Intentional, or a bug"....
List pgsql-sql
Hi again.

First of all, tank you for the immediate and precise answers.

My solution to the problem was the following. However, I found
that to be quite slow. I would like to ask if one can suggest me
how to optimize this, because I need this regularly.

CREATE FUNCTION gyegyenlo(text, text) RETURNS boolean AS ' SELECT CASE WHEN $1 is null and $2 is null THEN true
                        ELSE ($1) = ($2)      END;
 
' LANGUAGE 'sql';

CREATE OPERATOR ~= ( leftarg = text, rightarg = text, procedure = gyegyenlo, commutator = ~=
);

After these I use ~= if I need lines with NULLs in both to be selected.

The only problem is that it makes the query very slow. Does anyone
knows how to optimize this?

Thanks,
Baldvin




pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: optimizing queries and indexes...
Next
From: Tom Lane
Date:
Subject: Re: Part 2 of "Intentional, or a bug"....