Re: more docs on extending postgres in C - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: more docs on extending postgres in C
Date
Msg-id 20100120180919.6bc2ce8b@dawn.webthatworks.it
Whole thread Raw
In response to Re: more docs on extending postgres in C  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: more docs on extending postgres in C  (Greg Smith <greg@2ndquadrant.com>)
List pgsql-general
On Wed, 20 Jan 2010 17:38:17 +0100
Pavel Stehule <pavel.stehule@gmail.com> wrote:

> > Is there a reference of all macro and functions?

> no, only source code

It would be nice to at least a list of functions that could be used
in extension development to avoid reading all the source.

Since I'm a new entry in pg C coding and internals it will take me
ages to just find what's worth to know. I'll try to take some notes
while I grasp stuff and publish them somewhere.

I'm still trying to digest:

There are two ways you can build a composite data value (henceforth
a "tuple"): you can build it from an array of Datum values, or from
an array of C strings that can be passed to the input conversion
functions of the tuple's column data types. In either case, you
first need to obtain or construct a TupleDesc descriptor for the
tuple structure. When working with Datums, you pass the TupleDesc to
BlessTupleDesc, and then call heap_form_tuple for each row. When
working with C strings, you pass the TupleDesc to
TupleDescGetAttInMetadata, and then call BuildTupleFromCStrings for
each row. In the case of a function returning a set of tuples, the
setup steps can all be done once during the first call of the
function.

I grep throu contrib and I wasn't able to find anything that really
enlighted me about BlessTupleDesc.

I'll try to see if tomorrow things will look clearer.

thanks

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


pgsql-general by date:

Previous
From: Vincenzo Romano
Date:
Subject: Re: About partitioning
Next
From: Harald Fuchs
Date:
Subject: Re: Statement level triggers