Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Robert Haas
On Mon, Jan 6, 2014 at 11:34 AM, Tom Lane wrote: > Masterprojekt Naumann1 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_getall

Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Tom Lane
Masterprojekt Naumann1 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

Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Masterprojekt Naumann1
2014/1/6 Thomas Fanghaenel > On Mon, Jan 6, 2014 at 8:09 AM, Masterprojekt Naumann1 > wrote: > > Why is the memory of the variable uninitialized? > > Are you checking that "i <= slot->tts_nvalid" before accessing the > tts_values and tts_isnull arrays? > Thanks for your ideas! I could fix the

Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Thomas Fanghaenel
On Mon, Jan 6, 2014 at 8:09 AM, Masterprojekt Naumann1 wrote: > Why is the memory of the variable uninitialized? Are you checking that "i <= slot->tts_nvalid" before accessing the tts_values and tts_isnull arrays? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make ch

Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Masterprojekt Naumann1
2014/1/6 Craig Ringer > On 01/06/2014 09:09 PM, Masterprojekt Naumann1 wrote: > > > Why is the memory of the variable uninitialized? > > Are there any other patches you've made to the running PostgreSQL instance? > > I'd want to run under Valgrind and see what turned up. This might be a > bit tri

Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Craig Ringer
On 01/06/2014 09:09 PM, Masterprojekt Naumann1 wrote: > Why is the memory of the variable uninitialized? Are there any other patches you've made to the running PostgreSQL instance? I'd want to run under Valgrind and see what turned up. This might be a bit tricky with an intermittent fault during

Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Masterprojekt Naumann1
Yes, in some cases, Datum is 0, which I test before conversion. Additionally, I looked at tts_isnull but it does not prevent the segmentation fault in some cases. The problem is. that sometimes the value is random, but I don't know why and how I can detect that case. 2014/1/6 Heikki Linnakangas

Re: [HACKERS] Convert Datum* to char*

2014-01-06 Thread Heikki Linnakangas
On 01/06/2014 03:09 PM, Masterprojekt Naumann1 wrote: I want to read an attribute value from a TupleTableSlot. When I try to convert an attribute of SQL type varchar from Datum* to char* with the help of the method TextDatumGetCString(...), sometimes there is a segmentation fault. The segmentatio