Re: [HACKERS] Re: Bugs: Programming Language Functions - Mailing list pgsql-docs

From Tom Lane
Subject Re: [HACKERS] Re: Bugs: Programming Language Functions
Date
Msg-id 1708.955474421@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: Bugs: Programming Language Functions  ("Andrew C.R. Martin" <a.c.r.martin@reading.ac.uk>)
List pgsql-docs
"Andrew C.R. Martin" <a.c.r.martin@reading.ac.uk> writes:
>> Hm.  I'm not too clear on why that would need to worry about either
>> TupleTableSlot or GetAttributeByName ... shouldn't it be a simple
>> function consuming a text Datum and producing another?

> Errrmmm, just following the instructions in the docs:

> Programmer's Manual, Chapter 4. Extensing SQL: Functins (page
> x414.htm), under the C examples.

OK, I see.  You've got a function that accepts an entire tuple and
has hard-wired assumptions about which fields to extract from the tuple.
Certainly there are cases where that's what's needed, but I'd be
inclined to define the function as taking two parameters int4 and text*,
then calling it as myfunc(table.codon, table.substitution).  That pushes
the need for tuple field access out of your code.

That doesn't affect the validity of your point, of course.  We have done
wholesale renamings of backend types, fields, and functions, as part of
an ongoing effort to clean up the code; and I expect there will be more
in future.  Perhaps we should pay more attention to not breaking user
functions unnecessarily when we do this.
        regards, tom lane


pgsql-docs by date:

Previous
From: "Andrew C.R. Martin"
Date:
Subject: Re: [HACKERS] Re: Bugs: Programming Language Functions
Next
From: "Henry B. Hotz"
Date:
Subject: Re: Re: Postgres vs. PostgreSQL