Re: Understanding Datum

From: Nick Raj <nickrajjain(at)gmail(dot)com>
To: Radosław Smogura <mail(at)smogura(dot)eu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Understanding Datum
Date: 2011-03-23 20:19:54
Message-ID: AANLkTimiy2CmGuWUAuvRToi6uOMo=kiqAbP9yUMXcjLS@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
In postgres, typedef uintptr_t Datum
Datum is getting value from PG_GETARG_POINTER(1);
But, now problem is how would i know the type of PG_GETARG_POINTER(1)
(postgres internally pass this argument) to figure out datum type?

Can you tell detailed structure of Datum, so i can print the value?? How to
find out what type of pointer argument is PG_GETARG_POINTER(1)??

Thanks,
Nirmesh

On Wed, Mar 23, 2011 at 11:40 PM, Radosław Smogura <mail(at)smogura(dot)eu> wrote:

> Nick Raj <nickrajjain(at)gmail(dot)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
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vick Khera 2011-03-23 20:30:11 Re: pdf saving into DB vs. saving file location ?
Previous Message Andrew Sullivan 2011-03-23 20:17:45 Re: pdf saving into DB vs. saving file location ?