[PATCH] Document that directly callable functions may use fn_extra - Mailing list pgsql-hackers

From Craig Ringer
Subject [PATCH] Document that directly callable functions may use fn_extra
Date
Msg-id CAMsr+YGiK5ZukbdB+dLVLzB13y7eZ42iDMYZEmmiT8N5HR-wcQ@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] Document that directly callable functions may use fn_extra
List pgsql-hackers
Hi all

I was a puzzled by  src/backend/utils/fmgr/README and fmgr.h's descriptions of fcinfo->flinfo->fn_extra (FmgrInfo.fn_extra) as they seem to conflict with actual usage.

The docs suggest that fl_extra is for the use of function call handlers, but in practice it's also used heavily by function implementations as a cache space.

For example, SQL functions use fn_extra in init_sql_fcache, plpgsql uses it in plpgsql_compile, but also most of the array functions use it for a type cache.

I'm inclined to change the docs to say that functions called directly by the fmgr may also use fn_extra (per existing practice). Handlers that wrap functions usually called directly by the fmgr must save and restore fn_extra or leave it untouched.

Trivial patch to do the above attached.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
Attachment

pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: RFC: Remove contrib entirely
Next
From: Amit Langote
Date:
Subject: Re: RFC: Remove contrib entirely