RE: [SQL] prob with aggregate and group by - returns multiples
RE: [SQL] prob with aggregate and group by - returns multiples
От:
George Dau <gedau@isa.mim.com.au>
Дата:
The selects below are self-contained. The one that is failing is, in full, #!/bin/bash # psql web < writes: > select count(site), site from hits group by site; > The output contains lines like the following. Note that these are all > consecutive in the output. > 2|xlink.zdnet.com > 2|xlink.zdnet.com > 1|xlink.zdnet.com > 2|xlink.zdnet.com > 2|xlink.zdnet.com > 2|xlink.zdnet.com > 3|xlink.zdnet.com > 2|xlink.zdnet.com > 3|xlink.zdnet.com > 2|xlink.zdnet.com > 1|xlink.zdnet.com > Suspecting that there were differences in each xlink.zdnet.com, I counted > just them: > web=> select count (*) from hits where site='xlink.zdnet.com'; > count > ----- > 22 > (1 row) > So, all 22 xlink.zdnet.com are selected above, but they have not grouped in > the previous one. Any ideas why? Wow, that is bizarre. My first thought was that you had varying numbers of trailing blanks in the "site" values, but your second example seems to disprove that theory. What Postgres version are you running, and on what platform? Can you generate a self-contained example (a script that demonstrates the error from a standing start)? I suspect you may be hitting a platform- specific porting problem, but it's just speculation unless we have a self-contained test case to try on other machines. > On a lesser note: I tried "select * into temp from hits" as per the doco, > but it barfs. Postgres thinks that TEMP is a keyword, so it won't take it as a table name unless you put quotes around it. If we have doco examples that use TEMP as a table name, they need to be changed --- do you recall where you saw that, exactly? regards, tom lane ************************************************************** The information contained in this E-Mail is confidential and is intended only for the use of the addressee(s). If you receive this E-Mail in error, any use, distribution or copying of this E-Mail is not permitted. You are requested to forward unwanted E-Mail and address any problems to the MIM Holdings Limited Help Desk. E-Mail: helpdesk@mim.com.au or phone: Australia 07 3833 8042. **************************************************************
Re: [SQL] prob with aggregate and group by - returns multiples
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
George Dau writes: > I have postgresql version 6.2 running on RedHat Linux kernel 2.2.5 6.2 ??? Sorry, fella, but that's roughly Late Neolithic Era in Postgres time. I have no doubt that what you are running into is a long-dead bug. You won't find much enthusiasm among the developers for remembering exactly what it was. I suggest an upgrade. > Upgrading to 6.5 will be either expensive (download) or very slow (buy > CD from Canada). I hope there is another solution. According to our mirror-sites list, you can find Postgres down under at ftp://mirror.aarnet.edu.au/pub/postgresql or http://postgresql.mirror.aarnet.edu.au. I'm not having any luck contacting that site from here right now, but perhaps it will work for you. If not, there are other mirrors that are at least on your side of the globe; see http://www.postgresql.org/sites.html. > The TEMP table references are in HTML doco in query.html where it describes > "select into". Ah, I see at least one such still there in the current version. Will get fixed. Thanks for the pointer. regards, tom lane
RE: [SQL] prob with aggregate and group by - returns multiples
От:
Peter Eisentraut <e99re41@DoCS.UU.SE>
Дата:
On Tue, 29 Feb 2000, George Dau wrote: > I have postgresql version 6.2 running on RedHat Linux kernel 2.2.5 The > box has 128Meg RAM and lotsa disk. Upgrading to 6.5 will be either > expensive (download) or very slow (buy CD from Canada). I hope there > is another solution. Wow, those still exist? The source is about 7MB and I'm sure it's mirrored in Australia. For the few dollars you might spend there you will move *light years* ahead in terms of speed, features, and reliability. I'm not even sure anyone remembers 6.2 in order to help you. :( -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden