Re: function given current output-row

From: Peter Pilsl <pilsl(at)goldfisch(dot)at>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: function given current output-row
Date: 2001-10-28 22:38:31
Message-ID: 20011028233831.A66482@i3.atat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Oct 28, 2001 at 01:30:47PM +0100, Peter Eisentraut wrote:
> Peter Pilsl writes:
>
> > Is there a function that returns the number of the current outputline
>
> The client application is going to have to count the row numbers anyway in
> order to loop through them, so there is no obvious benefit of having the
> server deal with this.

in my case I dont think so: for a special task I need to join and sort
the content of several tables with some ranking-values to get the 6
highestranked values of all tables.
The rankingvalue is a function itself and if an entry from table X is
choosen, then - to give entries in other tables more chance - all
other entries from this table should be downranked by 10. If a second
value is choosen, then by 20 and so on ...
Of course I could do this all in the client-application, but there
would be a very easy (and maybe performant) way to do all this in
postgreSQL, if I could only create a function, that would deliver
0,10,20 .. depending on the row it appears.

select value,func from table order by rank(val1,val2,val3);
----+--
val1|0
val2|10
val3|20

I was thinking about doing it with sequences and reset the sequence
before each select-statement, but this will get very complex and lead
to other troubles ...

thnx,
peter

--
mag. peter pilsl

phone: +43 676 3574035
fax : +43 676 3546512
email: pilsl(at)goldfisch(dot)at
sms : pilsl(at)max(dot)mail(dot)at

pgp-key available

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Rogers 2001-10-28 22:41:03 Re: Ultimate DB Server
Previous Message mlw 2001-10-28 22:19:28 Re: Ultimate DB Server