From: | "Higuchi, Daisuke" <higuchi(dot)daisuke(at)jp(dot)fujitsu(dot)com> |
---|---|
To: | "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | [Bug Fix] ECPG: could not use set xxx to default statement |
Date: | 2019-02-19 04:04:10 |
Message-ID: | 1803D792815FC24D871C00D17AE95905DB51CE@g01jpexmbkw24 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I found ECPG's bug which SET xxx = DEFAULT statement could not be used.
[PROBLEM]
When the source code (*.pgc) has "EXEC SQL set xxx = default;", created c program by ECPG has no " = default".
For example, "EXEC SQL set search_path = default;" in *.pgc will be converted to "{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path", ECPGt_EOIT, ECPGt_EORT);}" in c program.
[Investigation]
gram.y lacks ";" in the end of section "generic_set", so preproc.y's syntax is broken.
src/backend/parser/gram.y
-------------------------------------------
generic_set:
| var_name '=' DEFAULT
{
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_SET_DEFAULT;
n->name = $1;
$$ = n;
}
set_rest_more: /* Generic SET syntaxes: */
-------------------------------------------
src/interfaces/ecpg/preproc/preproc.y
-------------------------------------------
generic_set:
| var_name TO DEFAULT
{
$$ = cat_str(2,$1,mm_strdup("to default"));
}
| var_name '=' DEFAULT set_rest_more:
generic_set
{
$$ = $1;
}
-------------------------------------------
I attached the patch which has ";" in the end of section "generic_set" and regression.
Regards,
Daisuke, Higuchi
Attachment | Content-Type | Size |
---|---|---|
FIX_ECPG_SET_TO_DEFAULT_v1.patch | application/octet-stream | 8.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-02-19 04:07:06 | Re: Prepared transaction releasing locks before deregistering its GID |
Previous Message | Michael Paquier | 2019-02-19 03:36:48 | Re: Reaping Temp tables to avoid XID wraparound |