Re: Understanding Datum - Mailing list pgsql-general

From Radosław Smogura
Subject Re: Understanding Datum
Date
Msg-id 201103231910.32027.mail@smogura.eu
Whole thread Raw
In response to Understanding Datum  (Nick Raj <nickrajjain@gmail.com>)
List pgsql-general
Nick Raj <nickrajjain@gmail.com> Wednesday 23 March 2011 18:45:41
> Hi,
> I am understanding the postgres code. In code, i just want to see what are
> values that are passing through the variables?
> Can you please tell me if the variable is of type Datum, then how to print
> its value? Because i dont the variable v type.
>
> And also what the structure of Datum?
>
> Thanks,
> Raj

The structure is explained in one of headers, generally Datum is pointer. It
points to memory containing at first four bytes integer describing size of
data in datum (use macro to extract this), and then, it's followed by bytes
containing data.

Actually almost each object is represented by structure like this
struct something {
    int4 size; //Required
//    Here put what you want
}
see headers.

If you want to present data from datum you need to 1) check what type of data
datum has (datum doesn't contain this) 2) Find datum representation for this
type.

Regards,
Radek

pgsql-general by date:

Previous
From: Jens Kapp
Date:
Subject: Re: Recursive function that receives a list of IDs and returns all child IDs
Next
From:
Date:
Subject: What does error "psql: Kerberos 5 authentication not supported" means?