pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kovacs Baldvin <kb136@hszk.bme.hu>
To: pgsql-sql@postgresql.org
Subject: Part 2 of "Intentional, or a bug"....
Date: Mon, 17 Sep 2001 00:02:29 +0200 (MEST)
Message-ID: <Pine.GSO.4.33.0109162349570.1893-100000@ural2> (raw)

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





view thread (3+ messages)  latest in thread

Message-ID: <Pine.GSO.4.33.0109162349570.1893-100000@ural2>
Permalink:  ../Pine.GSO.4.33.0109162349570.1893-100000@ural2/
Also on:    postgresql.org/message-id/Pine.GSO.4.33.0109162349570.1893-100000@ural2

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kb136@hszk.bme.hu
  Subject: Re: Part 2 of "Intentional, or a bug"....
  In-Reply-To: <Pine.GSO.4.33.0109162349570.1893-100000@ural2>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox