dbTalk Databases Forums  

[BUGS] group by

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] group by in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] group by - 05-13-2006 , 08:53 AM






Dear Developers,

There is a possible bug in 'select ... group by' SQL.
I reported it on the bugreport form on the web. (I think it number is
2416?). But no any reaction to it.
It is not problem for me, I make my results in other way. But it is
possible problem for other pepoples.

I reproduced it in smaller database table in other way. (with 180000
records) (postgresql 8.03 on linux)
e.g.:
there is a table:
stat-# \d summary
Table "public.summary"
colum | Type | MódosÃ*tó
-----------+------------------------+----------
kifejezes | character varying(300) | not null
cnt | integer | not null
talalat | integer |
Indexes:
"idx_summary_cnt" btree (cnt) CLUSTER
"idx_summary_kifejezes" btree (kifejezes text_pattern_ops)

1)
select kifejezes, count(kifejezes) from summary group by kifejezes
having count(kifejezes)>1;
the result is:
kifejezes | count
-------------------------+-------
csúcscsajok | 2
jászszentandrás | 3
kullancscsÃ*pés | 2
magannyugdijpenztar | 2
magánnyugdijpénztár | 2
magánnyugdÃ*jpénztár | 3
magánnyugdÃ*jpénztárak | 2
művelÅdésszociológia | 2
otp magánnyugdÃ*jpénztár | 2
(9 rows)

2)
select * from summary where kifejezes like 'jegygy%';
kifejezes | cnt | talalat
------------+-----+---------
jegygyürű | 4 | 0
jegygyűrű | 5 | 0
jegygyűrű | 7 | 0
jegygyűrű | 12 | 0
jegygyűrűk | 3 | 0
(5 rows)


Why not is in the first query results the "jegygyűrű" (second query
rows )?

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] group by - 05-13-2006 , 12:52 PM






YourSoft <yoursoft (AT) freemail (DOT) hu> writes:
Quote:
1)
select kifejezes, count(kifejezes) from summary group by kifejezes
having count(kifejezes)>1;
the result is:
kifejezes | count
-------------------------+-------
csúcscsajok | 2
jászszentandrás | 3
kullancscsÃ*pés | 2
magannyugdijpenztar | 2
magánnyugdijpénztár | 2
magánnyugdÃ*jpénztár | 3
magánnyugdÃ*jpénztárak | 2
művelÅdésszociológia | 2
otp magánnyugdÃ*jpénztár | 2
(9 rows)

2)
select * from summary where kifejezes like 'jegygy%';
kifejezes | cnt | talalat
------------+-----+---------
jegygyürű | 4 | 0
jegygyűrű | 5 | 0
jegygyűrű | 7 | 0
jegygyűrű | 12 | 0
jegygyűrűk | 3 | 0
(5 rows)

Why not is in the first query results the "jegygyűrű" (second query
rows )?
We've seen problems like this occur when you have mismatched locale and
encoding specifications --- that can confuse strcoll() to the point that
it gives inconsistent results, and since all PG character comparisons
depend on strcoll(), you get all sorts of bizarre behavior. Check the
LC_COLLATE and LC_CTYPE settings of the database, and make sure that you
have selected a database encoding that matches them.

Also, if you're using Hungarian locale, you probably need to update to
PG 8.0.6 or later. See bug fix list at
http://developer.postgresql.org/docs...ase-8-0-6.html

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] group by - 05-14-2006 , 03:45 AM



Dear Tom,

Thanks for suggestion. I upgrade my database to 8.1.3 and it is solve
the problem :-)

Regards,
Ferenc

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.