[PATCH] Document that directly callable functions may use fn_extra

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Document that directly callable functions may use fn_extra
Date: 2015-05-29 02:15:32
Message-ID: CAMsr+YGiK5ZukbdB+dLVLzB13y7eZ42iDMYZEmmiT8N5HR-wcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Document-that-fn_extra-is-also-usable-as-a-cache-by-.patch text/x-patch 2.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2015-05-29 02:29:38 Re: RFC: Remove contrib entirely
Previous Message Joshua D. Drake 2015-05-29 02:14:54 Re: RFC: Remove contrib entirely