Re: [HACKERS] RelFileNode to Relation

2013-10-19 Thread Soroosh Sardari
On Sat, Oct 19, 2013 at 11:53 AM, Tom Lane  wrote:

> Soroosh Sardari  writes:
> > I need to get a Relation instance but I have only a RelFileNode!
>
> Why do you think you need to do that?  Such a lookup is inherently the
> wrong thing, because relations' relfilenode values are not fixed (unless
> you have a lock on the relation, which presumably you don't).
>
> regards, tom lane
>


I know, it's against PG abstraction.
In PG we don't need to know anything about relation in the smgr level. but
in my project i want to encrypt
all pages of a particular relation and decrypt it when those pages are
fetching back to buffer.

This behavior depends on some relation properties. So in smgropen I must
get some knowledge about the relation and all of i have is RelFileNode.

I can not see the pg_class for the relation oid, because smgropen may
called before insertion in pg_class.

Soroosh


Re: [HACKERS] RelFileNode to Relation

2013-10-19 Thread Tom Lane
Soroosh Sardari  writes:
> I need to get a Relation instance but I have only a RelFileNode!

Why do you think you need to do that?  Such a lookup is inherently the
wrong thing, because relations' relfilenode values are not fixed (unless
you have a lock on the relation, which presumably you don't).

regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] RelFileNode to Relation

2013-10-19 Thread Soroosh Sardari
Hi

I need to get a Relation instance but I have only a RelFileNode!
I see the relcache.h, only the following function seems helpful

extern Relation RelationIdGetRelation(Oid relationId);

However, there is another problem, In the RelFileNode, only relNode exist
and as comment said this is equivalent to pg_class.relfilenode and in some
situation relation oid (pg_class.oid) and relation file node are not the
same.

So i cant use above function!

Any idea?

Regards,
Soroosh Sardari
Sharif University of Tech.