Hi,
I am currently struggling to write a "serialize"-like function
that would dump a row of a table into a string-like object in a way that
would allow me to reconstruct the original row (or its individual
elements) from this object.
The tentative plan I have is something like this:
1) Write a C-function declared something like so:
Datum serialise(PG_FUNCTION_ARGS)
2) Inside the function, get the pointer to the row using:
TupleTableSlot *row = PG_GETARGPOINTER(0);
3) Use GetAttributeByName to get the "Datum" value corresponding
to each of the attributes.
This is where I am stuck. What I want to do now is to use this datum value
returned by GetAttributeByName to get at the "glob of memory" occupied by
the attribute and "memmove" it into an area declared as text. I could then
store this text as a row in a table. Is this at all possible or am I
talking through my hat ;)
I am sorry I dont understand the backend variable storage and
types too well and would be grateful for some help.
Regards and Thanks,
Gurunandan