Re: [HACKERS] ODMG interface

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] ODMG interface
Дата
Msg-id 2397.926270519@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] ODMG interface  (Chris Bitmead <chris.bitmead@bigfoot.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Re: [ADMIN] maximum attribute record.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Oops, I seem to have changed UNION's behavior