From: | Yves Weißig <weissig(at)rbg(dot)informatik(dot)tu-darmstadt(dot)de> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Best way to construct Datum out of a string? |
Date: | 2011-04-28 12:07:06 |
Message-ID: | 4DB9586A.80107@rbg.informatik.tu-darmstadt.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Am 28.04.2011 05:52, schrieb Tom Lane:
> =?ISO-8859-15?Q?Yves_Wei=DFig?= <weissig(at)rbg(dot)informatik(dot)tu-darmstadt(dot)de> writes:
>> Am 27.04.2011 16:11, schrieb Heikki Linnakangas:
>>> What kind of a Datum do you want it to be? What data type? See
>>> CStringGetDatum, or perhaps CStringGetTextDatum(). Or perhaps you want
>>> to call the input function of some other datatype, with InputFunctionCall.
>
>> Ok, but how do I do that?
>
>> Currently I am using:
>
>> _ebi_mtab_insert(rel, CStringGetTextDatum(BVEC_NULL), bin_enc);
>
>> This function does not mere than hashing the 2nd passed argument (with
>> the internal hash functions of hash.c) but each time a different hash
>> value is returned, so I am thinking I might pass a pointer and not the
>> real Datum. I am highly irritated now... as for now I thought I
>> understood Datum...
>
> Well, it's hard to say for sure when you haven't shown us either what
> BVEC_NULL means or what _ebi_mtab_insert is doing with the value it gets
> ... but in fact a text Datum *is* a pointer, as is the Datum value for
> any other pass-by-reference type. Datum isn't magic, it's only a
> pointer-sized integer type. For anything bigger than that, the Datum
> value is a pointer to some data somewhere else.
>
> regards, tom lane
>
Sorry for giving so little information. I found the bug myself, I was
trying to hash a Datum created with CStringGetTextDatum with hashint4, I
certainly noticed this when I looked at the function which was actually
called by: hash_value = DatumGetUInt32(FunctionCall1(procinfo, value));
Thanks for trying to help!
Yves
From | Date | Subject | |
---|---|---|---|
Next Message | David Fetter | 2011-04-28 12:36:20 | Re: Predicate locking |
Previous Message | Yves Weißig | 2011-04-28 12:03:45 | new AM, best way to obtain new block at end of index? |