Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

DB2's row_number()


  • From: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
  • To: pgsql-hackers(at)postgresql(dot)org
  • Subject: DB2's row_number()
  • Date: Thu, 17 Jul 2003 17:03:03 +0200
  • Message-id: <3F16BAA7.4090503@cybertec.at> <text/plain>

I had a brief look at DB2's row_number function which seems to be pretty useful.
What it does is:

test=# SELECT row_number(), relname FROM pg_class LIMIT 3;
 row_number |    relname
------------+----------------
          1 | pg_description
          2 | pg_group
          3 | pg_proc
(3 rows)

This makes sense to me and I need this feature from time to time. My question is: How do I find out when a query starts? Inside a table function I can call SRF_IS_FIRSTCALL() to see when it is called first. Is there an easy way to check that inside an "ordinary" C function returning just one value? Currently my function counts the number of times it has been called per connection. I could write a second function for resetting the counter but this is not too smart ...

	Regards,

		Hans


--
Cybertec Geschwinde u Schoenig
Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
Tel: +43/2952/30706; +43/664/233 90 75
www.cybertec.at, www.postgresql.at, kernel.cybertec.at





Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group