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

From Greg Stark
Subject Re: SQL challenge--top 10 for each key value?
Date
Msg-id 871xmvf7sz.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: SQL challenge--top 10 for each key value?  (elein <elein@varlena.com>)
Responses Re: SQL challenge--top 10 for each key value?
List pgsql-sql
elein <elein@varlena.com> writes:

> 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.

Does this approach have a hope of working if it's used twice in the same
query?


-- 
greg



pgsql-sql by date:

Previous
From: elein
Date:
Subject: Re: SQL challenge--top 10 for each key value?
Next
From: Bret Hughes
Date:
Subject: trigger/for key help