Re: Re: Support for %TYPE in CREATE FUNCTION

From: Michael Samuel <michael(at)miknet(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: Support for %TYPE in CREATE FUNCTION
Date: 2001-06-01 13:11:13
Message-ID: 20010601231113.A5405@miknet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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(at)miknet(dot)net>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2001-06-01 13:31:05 Re: Access statistics
Previous Message Oleg Bartunov 2001-06-01 09:41:53 Re: First version of multi-key index support for GiST

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2001-06-01 15:04:10 Re: Fw: Isn't pg_statistic a security hole - Solution Proposal
Previous Message Zeugswetter Andreas SB 2001-06-01 07:55:54 AW: Re: Support for %TYPE in CREATE FUNCTION