From: | Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | T_Float morph to T_Integer after nodeRead |
Date: | 2017-01-06 01:31:26 |
Message-ID: | 9A28C8860F777E439AA12E8AEA7694F801281D08@BPXM15GP.gisp.nec.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)ak(dot)jp(dot)nec(dot)com>
From | Date | Subject | |
---|---|---|---|
Next Message | Jonathon Nelson | 2017-01-06 01:32:13 | Re: [PATCH] guc-ify the formerly hard-coded MAX_SEND_SIZE to max_wal_send |
Previous Message | Andres Freund | 2017-01-06 01:02:19 | Re: Reporting planning time with EXPLAIN |