Re: Convert Datum* to char*

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Masterprojekt Naumann1 <mpws2013n1(at)gmail(dot)com>, Thomas Fanghaenel <tfanghaenel(at)salesforce(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Convert Datum* to char*
Date: 2014-01-06 21:23:34
Message-ID: CA+Tgmob_1yVBsFxO47yREdNYm4BrFtHizcb4xqShsL2YkN5KSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 6, 2014 at 11:34 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Masterprojekt Naumann1 <mpws2013n1(at)gmail(dot)com> writes:
>> Nevertheless, slot->tts_nvalid is always 0. I hope that there is no other
>> problem.
>
> You should not be touching the tts_values/tts_isnull arrays without having
> first called slot_getsomeattrs or slot_getallattrs.
>
> See comments in src/include/executor/tuptable.h for some documentation.

Another problem is that TextDatumGetCString() is only the right thing
to do if the value is, in fact, of type text. If you've got an
integer column, for example, TextDatumGetCString() is not your friend.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message AK 2014-01-06 22:28:19 Re: How to reproduce serialization failure for a read only transaction.
Previous Message Florian Pflug 2014-01-06 21:21:53 Re: How to reproduce serialization failure for a read only transaction.