[HACKERS] T_Float morph to T_Integer after nodeRead - Mailing list pgsql-hackers

From Kouhei Kaigai
Subject [HACKERS] T_Float morph to T_Integer after nodeRead
Date
Msg-id 9A28C8860F777E439AA12E8AEA7694F801281D08@BPXM15GP.gisp.nec.co.jp
Whole thread Raw
Responses Re: [HACKERS] T_Float morph to T_Integer after nodeRead
List pgsql-hackers
I noticed a strange behavior when T_Float value is serialized, then deserialized
on the worker process for cpu parallel execution.

Simplified description of what I did is: fval = makeFloat(psprintf("%.0f", plan_nrows)); custom_scan->custom_private =
list_make1(fval);

This string expression contains no dot, then Float value was written out
as if it is an integer value, like "654321".

nodeRead() calls nodeTokenType() to determine the token type.
It determines a numeric token with no dot an Integer value, even if it is
generated by makeFloat(). Then, the worker process reference this value
using floatVal() and gets SEGV.

A workaround is that we never use "%.0f" format for makeFloat().
It may be sufficient because we have small number of makeFloat() call all
around the source tree. Or, do we have any other systematic solution to
prevent numeric cstring without dot?

Thanks,
----
PG-Strom Project / NEC OSS Promotion Center
KaiGai Kohei <kaigai@ak.jp.nec.com>





pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] Reporting planning time with EXPLAIN
Next
From: Jonathon Nelson
Date:
Subject: Re: [HACKERS] [PATCH] guc-ify the formerly hard-coded MAX_SEND_SIZEto max_wal_send