Re: SQL challenge--top 10 for each key value? - Mailing list pgsql-sql

From elein
Subject Re: SQL challenge--top 10 for each key value?
Date
Msg-id 20040410164651.K409@cookie.varlena.com
Whole thread Raw
In response to Re: SQL challenge--top 10 for each key value?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: SQL challenge--top 10 for each key value?
List pgsql-sql
Welcome to the real world, Josh.  There are people who
have full time salaried positions soley to attend 
standards meetings.

Note that ROW_NUMBER() really is handy, regardless of the
silly name.  And there was a little python function of mine 
that did it fairly simply, except that you needed to
initialize the counter in the connection before use.

create or replace function pycounter(integer)
returns integer as
'  if args[0] == 0:     SD["nextno"] = 1     return SD["nextno"]  try:     SD["nextno"] += 1  except:     SD["nextno"]
=1  return SD["nextno"]
 
' language 'plpythonu';

And clearly it can be done faster as a little
C function.

elein


On Fri, Apr 09, 2004 at 09:06:39AM -0700, Josh Berkus wrote:
> Rod,
> 
> > Something along the lines of the below would accomplish what you want
> > according to spec. ROW_NUMBER() is a spec defined function. (6.10 of
> > SQL200N)
> 
> Great leaping little gods!   They added something called "row number" to the 
> spec? 
> 
> Boy howdy, folks were right ... the ANSI committee really has completly blown 
> off the relational model completely.   First there was the addition of 
> network-database functions so that IBM could make DB2 look more like a real 
> database, now this ....
> 
> When a standards committee becomes hostage to a handful of vendors, kiss real 
> standards goodbye.
> 
> -- 
> Josh Berkus
> Aglio Database Solutions
> San Francisco
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend


pgsql-sql by date:

Previous
From: Troels Arvin
Date:
Subject: Re: SQL challenge--top 10 for each key value?
Next
From: elein
Date:
Subject: Re: SQL challenge--top 10 for each key value?