Re: [HACKERS] SELECT BUG

Поиск
Список
Период
Сортировка
От José Soares
Тема Re: [HACKERS] SELECT BUG
Дата
Msg-id 37CD52C2.6A894BF4@sferacarta.com
обсуждение исходный текст
Ответ на Re: [HACKERS] SELECT BUG  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] SELECT BUG  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
<tt>You mean that "a1 " is not equal to "a1      " ?</tt><br /><tt>but PostgreSQL has a different behavior in the
followingexample:</tt><tt></tt><p><tt>hygea=> select code,len(code) as len_of_code,code1, len(code1) as
len_of_code1</tt><br/><tt>from master1 where code = code1;</tt><tt></tt><p><tt>code      |len_of_code|code1      
|len_of_code1</tt><br/><tt>----------+-----------+------------+------------</tt><br /><tt>a1        |        
10|a1         |          15</tt><br /><tt>(1 row)</tt><br /><tt></tt> <tt></tt><p><tt>in this case the test code =
code1is true even if these fields have</tt><br /><tt>different number of trailling
spaces.</tt><tt></tt><p><tt>Thereforeif the above test is OK there's a bug on:</tt><tt></tt><p><tt>        select m.*,
d.*from master1 m, detail1 d where m.code=d.code;</tt><br /><tt></tt> <tt></tt><p><tt>José</tt><br
/><tt></tt> <tt></tt><p><tt>TomLane ha scritto:</tt><blockquote type="CITE"><tt>José Soares <jose@sferacarta.com>
writes:</tt><br/><tt>> --I have the following test data into these tables:</tt><tt></tt><p><tt>> hygea=>
select* from master1;</tt><br /><tt>> code</tt><br /><tt>> -----------</tt><br /><tt>> a</tt><br /><tt>>
a1</tt><br/><tt>> a13</tt><br /><tt>> (3 rows)</tt><tt></tt><p><tt>> hygea=> select * from detail1;</tt><br
/><tt>>code</tt><br /><tt>> ----------------</tt><br /><tt>> a13</tt><br /><tt>> a13</tt><br /><tt>>
a1</tt><br/><tt>> (3 rows)</tt><tt></tt><p><tt>> --if I try to join these two tables I have the following
(nothing):</tt><tt></tt><p><tt>>hygea=> select m.*, d.* from master1 m, detail1 d where m.code=d.code;</tt><br
/><tt>>code|code</tt><br /><tt>> ----+----</tt><br /><tt>> (0 rows)</tt><br /><tt>> --and now trying with
TRIMfunction... it works!</tt><tt></tt><p><tt>> hygea=> select m.*, d.* from master1 m, detail1 d where</tt><br
/><tt>>trim(m.code)=trim(d.code</tt><br /><tt>> code       |code</tt><br /><tt>>
-----------+----------------</tt><br/><tt>> a13        |a13</tt><br /><tt>> a13        |a13</tt><br /><tt>>
a1        |a1</tt><br /><tt>> (3 rows)</tt><tt></tt><p><tt>Looks to me like you have differing numbers of trailing
spacesin the</tt><br /><tt>entries in each table.  If so, this is not a
bug.</tt><tt></tt><p><tt>                       regards, tom lane</tt></blockquote> 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: [HACKERS] Implications of multi-byte support in a distribution
Следующее
От: Hannu Krosing
Дата:
Сообщение: Re: [HACKERS] Implications of multi-byte support in a distribution