I'm following Postgres documentation https://www.postgresql.org/docs/8.2/xfunc-c.html for writing C function and creating the extension (for hierarchial clustering) and I'm confused.
- So I can get a tuple by using
HeapTupleHeader t = PG_GETARG_HEAPTUPLEHEADER(0);
- How can I get attribute values in this tuple? We have
GET_ARGUMENT_BY_NUM
, can I get a value for each column and put it into an array? (For some reason i want to get data from table and for example, clusterize it). - There is an example of using specific table for a function (emp table). How can I use random table for my function (I couldn't find the example)?
- Is
c_overpaid(emp, limit)
(in documentation) called one time for emp table, or is it called as much as the rows in the table? - for hierarchical-clustering: can I get table data from postgres, write it into a temp file, read that file, put it into array, clusterize it and put the result into database? (like create or alter table and do a partitioning? like this: hub - is whole table, part_1 is one cluster, part_2 is the second one etc)