Re: Re: Support for %TYPE in CREATE FUNCTION

Поиск
Список
Период
Сортировка
От Michael Samuel
Тема Re: Re: Support for %TYPE in CREATE FUNCTION
Дата
Msg-id 20010601231113.A5405@miknet.net
обсуждение исходный текст
Ответ на Re: Support for %TYPE in CREATE FUNCTION  (Pascal Scheffers <pascal@scheffers.net>)
Ответы Re: Re: Support for %TYPE in CREATE FUNCTION  (Ian Lance Taylor <ian@airs.com>)
Список pgsql-hackers
I've been thinking about this, and I think the smartest way to implement
%TYPE would be to have it as a special-case data type.  So, the C
representation of it would be something like this:

struct PercentType {int datatype;void *data;
};

Note: I made the datatype field an int, but that may/may not be the
correct datatype to use there.

And basically, postgres can resolve at runtime what it should point to,
and the code should have to deal with it, either via casting, or throwing
an exception if it's unacceptable.

Of course, there'd be a small overhead within the function, but it's a
small price to pay for a robust implementation.

As for operator overloading, a decision must be made whether you search
for a more specific function first, or for a matching %TYPE.

Of course, this may be too many special cases to be coded cleanly...

-- 
Michael Samuel <michael@miknet.net>


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: First version of multi-key index support for GiST
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Access statistics