Re: Documentation of C functions

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: Janek Sendrowski *EXTERN* <janek12(at)web(dot)de>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Documentation of C functions
Date: 2013-11-27 15:12:47
Message-ID: A737B7A37273E048B164557ADEF4A58B17C60D59@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Janek Sendrowski wrote:
> Is there a documentation of postgresql's C functions like SET_VARSIZE for exmaple?

For things like this consult the source code.

In src/include/postgres.h you'll find:

/*
* VARDATA, VARSIZE, and SET_VARSIZE are the recommended API for most code
* for varlena datatypes. Note that they only work on untoasted,
* 4-byte-header Datums!
*
* Code that wants to use 1-byte-header values without detoasting should
* use VARSIZE_ANY/VARSIZE_ANY_EXHDR/VARDATA_ANY. The other macros here
* should usually be used only by tuple assembly/disassembly code and
* code that specifically wants to work with still-toasted Datums.
*
* WARNING: It is only safe to use VARDATA_ANY() -- typically with
* PG_DETOAST_DATUM_PACKED() -- if you really don't care about the alignment.
* Either because you're working with something like text where the alignment
* doesn't matter or because you're not going to access its constituent parts
* and just use things like memcpy on it anyways.
*/

The server side C API is not documented in the documentation, because
it is already (hopefully) well documented in the source.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2013-11-27 15:13:57 Re: tracking scripts...
Previous Message Joey Quinn 2013-11-27 15:00:48 Re: tracking scripts...