Search Postgresql Archives

Re: Understanding Datum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 24 Mar 2011 10:50:32 +0530, Nick Raj wrote:
If Datum contains only the value (not having type specific info.),
then
Suppose i want to print the Datum V value (already defined in
postgres)
then printf("%??", V);

Because V is assigned by PG_GETARG_POINTER(1);
 I dont having the information of type Datum.

How to print the value of Datum in postgres?

On Thu, Mar 24, 2011 at 2:35 AM, Tom Lane  wrote:

Nick Raj writes:
> 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?

Datum does not carry any type information, only a value.
ÂFunctions are
typically coded to know their input types a priori. ÂIf you want
to
write code that is not type-specific then youd better be passing
around
type OIDs as well as values.

           Âregards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx
[2])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general [3]



Links:
------
[1] mailto:nickrajjain@xxxxxxxxx
[2] mailto:pgsql-general@xxxxxxxxxxxxxx
[3] http://www.postgresql.org/mailpref/pgsql-general
[4] mailto:tgl@xxxxxxxxxxxxx

You may only find this from code context. Bear in mind, in simple words, datum is like void* with additional size header.

If You write C function you now what kind of datum will income, and what should outcome (You declare this!). If you examine table, it's same situation, but You need ask system for this. Even if PG will have type bytes in Datum, PG supports custom types...

If you wan't to operate on datums You can't work in a way take some datum and work on it.

You need to obtain /context/, by getting what type tables has on column x, what type of results function will return, etc; You need to know from where Your datum income.

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux