Re: [HACKERS] SELECT BUG

From: José Soares <jose(at)sferacarta(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] SELECT BUG
Date: 1999-09-01 16:22:27
Message-ID: 37CD52C2.6A894BF4@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

You mean that "a1 " is not equal to "a1 " ?
but PostgreSQL has a different behavior in the following example:

hygea=> select code,len(code) as len_of_code,code1, len(code1) as
len_of_code1
from master1 where code = code1;

code |len_of_code|code1 |len_of_code1
----------+-----------+------------+------------
a1 | 10|a1 | 15
(1 row)

in this case the test code = code1 is true even if these fields have
different number of trailling spaces.

Therefore if the above test is OK there's a bug on:

select m.*, d.* from master1 m, detail1 d where m.code=d.code;

José

Tom Lane ha scritto:

> =?iso-8859-1?Q?Jos=E9?= Soares <jose(at)sferacarta(dot)com> writes:
> > --I have the following test data into these tables:
>
> > hygea=> select * from master1;
> > code
> > -----------
> > a
> > a1
> > a13
> > (3 rows)
>
> > hygea=> select * from detail1;
> > code
> > ----------------
> > a13
> > a13
> > a1
> > (3 rows)
>
> > --if I try to join these two tables I have the following (nothing):
>
> > hygea=> select m.*, d.* from master1 m, detail1 d where m.code=d.code;
> > code|code
> > ----+----
> > (0 rows)
> > --and now trying with TRIM function... it works!
>
> > hygea=> select m.*, d.* from master1 m, detail1 d where
> > trim(m.code)=trim(d.code
> > code |code
> > -----------+----------------
> > a13 |a13
> > a13 |a13
> > a1 |a1
> > (3 rows)
>
> Looks to me like you have differing numbers of trailing spaces in the
> entries in each table. If so, this is not a bug.
>
> regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 1999-09-01 16:27:45 [PATCHES] patch for 6.5.X tree (fwd)
Previous Message Tom Lane 1999-09-01 14:46:58 Re: [HACKERS] Changes for 6.5.2 ?