SELECT BUG
От | José Soares |
---|---|
Тема | SELECT BUG |
Дата | |
Msg-id | 37CD03AA.BC08CD19@sferacarta.com обсуждение исходный текст |
Ответы |
Re: [HACKERS] SELECT BUG
(Tom Lane <tgl@sss.pgh.pa.us>)
|
Список | pgsql-hackers |
<tt>I think I found some bugs in SELECT...</tt><br /><tt>I have two tables MASTER1 and DETAIL1 both of them with only onefield CODE</tt><br /><tt>of data type VARCHAR but MASTER1.CODE is 11 char long and DETAIL1.CODE 16 char l</tt><tt></tt><p><tt>hygea=>\d master1</tt><br /><tt>Table = master1</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><br/><tt>| Field | Type | Length|</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><br/><tt>| code | varchar() | 11 |</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><tt></tt><p><tt>hygea=>\d detail1</tt><br/><tt>Table = detail1</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><br/><tt>| Field | Type | Length|</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><br/><tt>| code | varchar() | 16 |</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><tt></tt><p><tt>--Ihave the followingtest 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 tablesI 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 withTRIM function... it works!</tt><tt></tt><p><tt>hygea=> select m.*, d.* from master1 m, detail1 d where 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>--andlast another variation using aliases: (note that I forgot to change</tt><br /><tt>-- MASTER1with m and DETAIL1 with d:</tt><br /><tt>hygea=> select master1.*, detail1.* from master1 m, detail1 d where trim(m.code)</tt><br/><tt>code |code</tt><br /><tt>-----------+----------------</tt><br /><tt>a |a13</tt><br/><tt>a1 |a13</tt><br /><tt>a13 |a13</tt><br /><tt>a |a13</tt><br /><tt>a1 |a13</tt><br/><tt>a13 |a13</tt><br /><tt>a |a1</tt><br /><tt>a1 |a1</tt><br /><tt>a13 |a1</tt><br/><tt>a |a13</tt><br /><tt>a1 |a13</tt><br /><tt>a13 |a13</tt><br /><tt>a |a13</tt><br/><tt>a1 |a13</tt><br /><tt>a13 |a13</tt><br /><tt>a |a1</tt><br /><tt>a1 |a1</tt><br/><tt>a13 |a1</tt><br /><tt>a |a13</tt><br /><tt>a1 |a13</tt><br /><tt>a13 |a13</tt><br/><tt>a |a13</tt><br /><tt>a1 |a13</tt><br /><tt>a13 |a13</tt><br /><tt>a |a1</tt><br/><tt>a1 |a1</tt><br /><tt>a13 |a1</tt><br /><tt>(27 rows)</tt><tt></tt><p>Any ideas? <p>José <br/>
В списке pgsql-hackers по дате отправления:
Следующее
От: Milan ZamazalДата:
Сообщение: Re: [HACKERS] Implications of multi-byte support in a distribution