Part 2 of "Intentional, or a bug"....

From: Kovacs Baldvin <kb136(at)hszk(dot)bme(dot)hu>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Part 2 of "Intentional, or a bug"....
Date: 2001-09-16 22:02:29
Message-ID: Pine.GSO.4.33.0109162349570.1893-100000@ural2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-09-16 23:06:01 Re: Part 2 of "Intentional, or a bug"....
Previous Message Josh Berkus 2001-09-16 20:36:38 Re: optimizing queries and indexes...