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

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: (view raw, whole thread or download thread mbox)
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.



pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group