Re: [HACKERS] ODMG interface - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] ODMG interface
Date
Msg-id 2397.926270519@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] ODMG interface  (Chris Bitmead <chris.bitmead@bigfoot.com>)
List pgsql-hackers
Chris Bitmead <chris.bitmead@bigfoot.com> writes:
>> I would propose a pseudo column (or funtion) so that one could do:
>> select rowrelname() as class_name, * from person*;
>> and then work from there on.

> Basicly that's what I want to implement, except that instead of
> returning the relname() I think the rel_classoid (oid of pg_class) is a
> better choice. Then obtaining the relname a simple join with pg_class.

OK, I'm starting to get the picture, and I agree there's no way to get
the system to give you this info now.  (You could store a user field
that provides the same info, of course, but that's kind of ugly.)

I think you'd have to implement it as a system attribute (like oid,
xid, etc) rather than as a function, because in a join scenario you
need to be able to indicate which tables you are talking about.
For example, to find men with wives named Sheila in your database:

select p1.classoid, p1.firstname, p1.lastname
from person* as p1, person* as p2
where p1.spouse = p2.oid and p2.firstname = 'Sheila';

If it were "select classoid(), ..." then you'd have no way to indicate
which person's classoid you wanted.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: [ADMIN] maximum attribute record.
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Oops, I seem to have changed UNION's behavior