Re: [HACKERS] Odd behavior with PG_TRY

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Odd behavior with PG_TRY
Дата
Msg-id 31436.1483415248@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [HACKERS] Odd behavior with PG_TRY  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: [HACKERS] Odd behavior with PG_TRY  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
> In the attached patch (snippet below), I'm seeing something strange with 
> args->in.r.atts[].

Did you try comparing the apparent values of "args" before and after
entering PG_TRY?

> I saw the comment on PG_TRY about marking things as volatile, but my 
> understanding from the comment is I shouldn't even need to do that, 
> since these variables aren't being modified.

Not sure, but if you do need to mark them volatile to prevent
misoptimization in the PG_TRY, this is not how to do it:

> volatile TupleDesc    desc = slot->tts_tupleDescriptor;
> volatile CallbackState *myState = (CallbackState *) self;
> volatile PLyTypeInfo *args = myState->args;

Correct coding would be
   volatile TupleDesc    desc = slot->tts_tupleDescriptor;   CallbackState * volatile myState = (CallbackState *) self;
 PLyTypeInfo * volatile args = myState->args;
 

because what needs to be marked volatile is the pointer variable,
not what it points at.  I'm a bit surprised you're not getting
"cast away volatile" warnings from the code as you have it.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: [HACKERS] Odd behavior with PG_TRY
Следующее
От: Pavan Deolasee
Дата:
Сообщение: Re: [HACKERS] Patch: Write Amplification Reduction Method (WARM)