From: | Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru> |
---|---|
To: | PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Clarification of nodeToString() use cases |
Date: | 2018-09-16 11:43:05 |
Message-ID: | 3690074f-abd2-56a9-144a-aa5545d7a291@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, Hackers!
In the AQO project (Adaptive Query Optimization) [1] the nodeToString()
function is used by the planner to convert an query parse tree into a
string to generate a hash value [2].
In PostgreSQL v.11 call nodeToString(parse) segfaulted.
The reason is: parse tree node for XMLNAMESPACES clause has null pointer
in the case of DEFAULT namespace (the pointer will be initialized at
executor on the first call). Function _outValue() uses value->val.str[0]
[3] without checking of value->val.str.
I want to know, which of next options is correct:
1. Converting a parse tree into string with nodeToString() is illegal
operation. We need to add a comment to the description of nodeToString().
2. We can use nodeToString() for parse tree convertation. In this case
we need to check node variable 'value->val.str' to NULL pointer (Now I
use this approach, see attachment).
[1] https://github.com/postgrespro/aqo
[2] hash.c, line 55.
[3] outfuncs.c, line 3312.
--
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company
Attachment | Content-Type | Size |
---|---|---|
0001-XML-Bug-fix.patch | text/x-patch | 826 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Cook | 2018-09-16 12:07:35 | Code of Conduct plan |
Previous Message | Chris Travers | 2018-09-16 10:38:41 | Re: Code of Conduct plan |