buildStringList fails to handle search_path with commas
jacobwgillespie opened this issue · comments
Describe the bug
It appears that functions with differing search paths result in incorrect output due to buildStringList
being unable to parse a search_path
with commas.
I'm not super familiar with the codebase here, so I can't pinpoint exactly where the error lives (otherwise I'd open a PR), but I have a function with two differing search paths:
search_path=pg_catalog
search_path=pg_catalog, public, pg_temp
In function.c
, it tries to build a list of options to set by calling setOperationOptions
here:
Lines 719 to 720 in 6e6619a
That function in turn calls buildStringList
on each of those strings. This results in the following:
Input to buildStringList |
Value of ret->head->value |
---|---|
search_path=pg_catalog |
search_path=pg_catalog |
search_path=pg_catalog, public, pg_temp |
pg_temp |
I believe the second row's result is incorrect. This results in the following SQL being written, without the SET
s being included:
ALTER FUNCTION schema.func_name();
Your environment
- Mac
- Postgres 12
- latest
master