[SQL] Intentional, or bug?

2001-09-16 Thread Kovacs Baldvin
Hi! I probably found an inconsistence of the working of the = operator. Please read ahead, if you're interested. I have two tables, let't call them a and b. They are: a) x | y - 1 | 100 2 | NULL b) y | z --

[SQL] Correction for the previous letter:

2001-09-16 Thread Kovacs Baldvin
Sorry, I made a mistake in my previous letter, the table b looks like this: b) y | z 100 (not 1) | 'Hallelujah' NULL| 'Hmm...' Bye, Baldvin ---(end of broadcast)--- TIP 5: Have you checked our extensiv

Re: [SQL] Intentional, or bug?

2001-09-16 Thread Tod McQuillin
On Sun, 16 Sep 2001, Kovacs Baldvin wrote: > select NULL = NULL; > > The answer is: true!!! This has got to be a bug. NULL is not equal to anything (nor is it unequal to anything). SQL uses tri-valued logic, where answers are either true, false, or unknown. When selecting where a = b, if eith

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-16 Thread Tom Lane
Richard NAGY <[EMAIL PROTECTED]> writes: > SELECT aes.ent_id, e.type, e.nom, aes.sect_id as voulu, > cvd_new(current_date, e.date_entree, 'new') FROM ass_entrep_sectact aes, > entreprise e WHERE e.id = aes.ent_id and aes.sect_id <> 3 and > aes.sect_id <> 9 > and aes.sect_id <> 1 and aes.sect_id <>

Re: [SQL] Intentional, or bug?

2001-09-16 Thread Tom Lane
Tod McQuillin <[EMAIL PROTECTED]> writes: > On Sun, 16 Sep 2001, Kovacs Baldvin wrote: >> select NULL = NULL; >> >> The answer is: true!!! > This has got to be a bug. NULL is not equal to anything (nor is it > unequal to anything). Indeed, this *should* yield NULL. But right now, postgres' pa

Re: [SQL] Intentional, or bug?

2001-09-16 Thread Stephan Szabo
On Mon, 17 Sep 2001, Tod McQuillin wrote: > On Sun, 16 Sep 2001, Kovacs Baldvin wrote: > > > select NULL = NULL; > > > > The answer is: true!!! > > This has got to be a bug. NULL is not equal to anything (nor is it > unequal to anything). This is because of a hack due to a broken MS client th

Re: [SQL] optimizing queries and indexes...

2001-09-16 Thread Josh Berkus
Tom, > [ Sorry for slow response, I've been out of town ] Taking a much-deserved vacation, hey? Any new job plans? > Postgres absolutely does not care: the optimizer will always consider > both A-join-B and B-join-A orders for every join it has to do. As > Stephan and Josh noted, you can cons

[SQL] Part 2 of "Intentional, or a bug"....

2001-09-16 Thread Kovacs Baldvin
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) RETU

Re: [SQL] Part 2 of "Intentional, or a bug"....

2001-09-16 Thread Tom Lane
Kovacs Baldvin <[EMAIL PROTECTED]> 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...