I am using the libpq-fe library in C to contact to a postgres database.
I am calling a stored procedure from my code using libpqfe which returns a timestamp.
I want to store this timestamp to a char array. But to do so I first have to know the size of timestamp so that I can declare the array. To get the size I am using int PQfsize(PGresult *res, int field_index);. You can found more about it here.
It returns the value 8. But actually the size of the timestamp(without zone) is 19.
Why PQfsize is returning wrong value?
I know that size of the timestamp is constant and I can directly declare an array and then retrieve the value using PQgetvalue, but how to declare arrays for the fields which don't have fixed size.
How to retrieve a field from PGresult to store it into any variable?