pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedPart 2 of "Intentional, or a bug"....
3+ messages / 2 participants
[nested] [flat]
* Part 2 of "Intentional, or a bug"....
@ 2001-09-16 22:02 Kovacs Baldvin <kb136@hszk.bme.hu>
2001-09-16 23:06 ` Re: Part 2 of "Intentional, or a bug".... Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Kovacs Baldvin @ 2001-09-16 22:02 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Part 2 of "Intentional, or a bug"....
2001-09-16 22:02 Part 2 of "Intentional, or a bug".... Kovacs Baldvin <kb136@hszk.bme.hu>
@ 2001-09-16 23:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-09-17 08:47 ` Re: Part 2 of "Intentional, or a bug".... Kovacs Baldvin <kb136@hszk.bme.hu>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2001-09-16 23:06 UTC (permalink / raw)
To: Kovacs Baldvin <kb136@hszk.bme.hu>; +Cc: pgsql-sql
Kovacs Baldvin <kb136@hszk.bme.hu> writes:
> After these I use ~= if I need lines with NULLs in both to be selected.
Perhaps you should reconsider your data model. You seem to be treating
NULL as if it were a real value, which is something that SQL discourages
rather strongly...
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Part 2 of "Intentional, or a bug"....
2001-09-16 22:02 Part 2 of "Intentional, or a bug".... Kovacs Baldvin <kb136@hszk.bme.hu>
2001-09-16 23:06 ` Re: Part 2 of "Intentional, or a bug".... Tom Lane <tgl@sss.pgh.pa.us>
@ 2001-09-17 08:47 ` Kovacs Baldvin <kb136@hszk.bme.hu>
0 siblings, 0 replies; 3+ messages in thread
From: Kovacs Baldvin @ 2001-09-17 08:47 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql
> > After these I use ~= if I need lines with NULLs in both to be selected.
>
> Perhaps you should reconsider your data model. You seem to be treating
The given column is a date type column, with some records where
"date is not given". This "not given" is represented by NULL.
I saw it more elegant than assigning a date in the very past for
"not given", or using a boolean column called "date given".
After all, I consider using the additional boolean column.
Bye,
Baldvin
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-09-17 08:47 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-09-16 22:02 Part 2 of "Intentional, or a bug".... Kovacs Baldvin <kb136@hszk.bme.hu>
2001-09-16 23:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-09-17 08:47 ` Kovacs Baldvin <kb136@hszk.bme.hu>
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