From: | elein <elein(at)varlena(dot)com> |
---|---|
To: | Josh Berkus <josh(at)agliodbs(dot)com> |
Cc: | Rod Taylor <pg(at)rbt(dot)ca>, Greg Stark <gsstark(at)mit(dot)edu>, Jeff Boes <jboes(at)nexcerpt(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: SQL challenge--top 10 for each key value? |
Date: | 2004-04-10 23:46:51 |
Message-ID: | 20040410164651.K409@cookie.varlena.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | elein | 2004-04-11 01:54:35 | Re: SQL challenge--top 10 for each key value? |
Previous Message | Yasir Malik | 2004-04-10 22:19:48 | Re: begin update ... syntax error |