From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Internal function call from C-language function |
Date: | 2006-12-08 09:53:48 |
Message-ID: | 20061208095348.GA25912@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Dec 07, 2006 at 06:01:13PM +0100, Zoltan Boszormenyi wrote:
> >I have just one more question:
> >How can I get an Oid out of a Datum, i.e.
> >how do I know what type I get in a given Datum?
> >DatumGetObjectId() seems to give me an Oid that
> >was specifically stored as a Datum.
>
> I have found the alternative solution.
> If t is HeapTupleHeader then:
<snip>
There is no way to tell what type is in a Datum, it's just that,
nothing else. The information about the actual type can come from
elsewhere, for example:
- If extracting from a tuple, the tuple descriptor has the type (as you found)
- If passed as argument, the fcinfo struct *may* have the type
information
- The SPI interface provide ways to get information also
On the other side, a Datum is abstract, and you can receive a Datum as
argument and pass it to other functions without needing to know what
type it is. But you better so it right because there is no type
checking on that level.
As for the backtrace, you can get gdb to attach to the backend after
you connect. Then when you get the segfault, gdb will catch it and show
you exactly where.
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Ragnar | 2006-12-08 10:17:56 | Re: How to use outer join in update |
Previous Message | Stéphane Schildknecht | 2006-12-08 09:33:17 | Excluding schema from backup |