"John Kennedy" <jmkennedyie@hotmail.com> writes:
> I am very new to PostgreSQL so apologies in advance if this bug report is a
> waste of time for some reason.
Not at all. Looks like you've found a mistake in where variables of
pass-by-reference datatypes get stored. Thanks for the report!
regards, tom lane