Thread: Final proposal for resolving C-vs-newC issue

Final proposal for resolving C-vs-newC issue

From
Tom Lane
Date:
If you care about the nitty-gritty details, see
http://www.postgresql.org/cgi/cvsweb.cgi/pgsql/src/backend/utils/fmgr/README
particularly the final section "Telling the difference between old- and
new-style functions".
        regards, tom lane


Re: Final proposal for resolving C-vs-newC issue

From
Philip Warner
Date:
At 17:16 19/11/00 -0500, Tom Lane wrote:
>If you care about the nitty-gritty details, see
>http://www.postgresql.org/cgi/cvsweb.cgi/pgsql/src/backend/utils/fmgr/README
>particularly the final section "Telling the difference between old- and
>new-style functions".

There is no mention of the handling of toasted values for old C functions.
Does this mean that it is possible for crashes to occur after a dump/load +
updates?

Since I'd guess we will keep the old C style interface in perpetuity, since
it allows calling of arbitrary object libraries, I think it would be very
sensible to detoast all parameters prior to calling a 'raw'(?) function.
Perhaps, if this is too expensive, we can add a new attribute to prevent
detoasting if necessary, perhaps 'eatstoast' ;-).


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


Re: Final proposal for resolving C-vs-newC issue

From
Tom Lane
Date:
Philip Warner <pjw@rhyme.com.au> writes:
> At 17:16 19/11/00 -0500, Tom Lane wrote:
>> http://www.postgresql.org/cgi/cvsweb.cgi/pgsql/src/backend/utils/fmgr/README

> There is no mention of the handling of toasted values for old C functions.

Did you not read to the end?

: To allow old-style dynamic functions to work safely on toastable datatypes,
: the handler for old-style functions will automatically detoast toastable
: arguments before passing them to the old-style function.  A new-style
: function is expected to take care of toasted arguments by using the
: standard argument access macros defined above.
        regards, tom lane


Re: Final proposal for resolving C-vs-newC issue

From
Philip Warner
Date:
At 21:31 19/11/00 -0500, Tom Lane wrote:
>Philip Warner <pjw@rhyme.com.au> writes:
>> At 17:16 19/11/00 -0500, Tom Lane wrote:
>>>
http://www.postgresql.org/cgi/cvsweb.cgi/pgsql/src/backend/utils/fmgr/README
>
>> There is no mention of the handling of toasted values for old C functions.
>
>Did you not read to the end?

'fraid not...8-(. Thanks.

>: To allow old-style dynamic functions to work safely on toastable datatypes,
>: the handler for old-style functions will automatically detoast toastable
>: arguments before passing them to the old-style function.  A new-style
>: function is expected to take care of toasted arguments by using the
>: standard argument access macros defined above.

----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/