Getting the OID inside the executor

From: Fazool <fazoolmein(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Getting the OID inside the executor
Date: 2011-09-02 03:14:27
Message-ID: CAO+OJGDmaqsMg3KYJC+2XzEa0D39Edd+eDcLvaF7DS+UYPhUMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello everyone,

I am implementing some functionality into Postgresql, where I want to
track which row was accessed by a user query. I am implementing the
functionality inside Postgres, so that there are no changes required
on client side (e.g. re-writing queries).
Rows are identified by OIDs, and I have set default_with_oids=true, so
that all tables are created with OIDs.

Now, when I run a 'select * from my_table', I can easily get the OID
inside the executor because I get a 'HeapTuple' from ExecSan(). I call
HeapTupleGetOid() on the heap tuple and I have the oid.

The problem is that when I run a query with a projection, e.g.,
'select name from my_table', then the scanner returns a null
HeapTuple. How can I get the OID in such a case?

What would be the best way of doing this? Should I modify the planner
to add 'get oid' as a junk filter? Would it affect something else?

Any comments will be highly appreciated.

Thanks!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-09-02 05:03:37 Re: Getting the OID inside the executor
Previous Message Greg Sabino Mullane 2011-09-02 01:40:16 Re: pg_restore --no-post-data and --post-data-only