From: | "higuchi(dot)daisuke(at)fujitsu(dot)com" <higuchi(dot)daisuke(at)fujitsu(dot)com> |
---|---|
To: | "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | [Bug fix] ECPG: ECPG preprocessor outputs "unsupported feature will be passed to server" even if the command is supported |
Date: | 2019-10-02 04:10:43 |
Message-ID: | TY2PR01MB247697CAE390B59085F9D929EC9C0@TY2PR01MB2476.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I found wrong message output when ECPG preprocessed some SQL commands .
For example, ECPG application has following command, ECPG outputs "unsupported feature will be passed to server".
-----------
EXEC SQL CREATE SCHEMA IF NOT EXISTS hollywood;
-----------
I attached sample code to reproduce this problem.
[Investigation]
I think parse.pl has some problem. The following filters do not seem to work properly:
src/interfaces/ecpg/preproc/parse.pl
if ($feature_not_supported == 1)
{
# we found an unsupported feature, but we have to
# filter out ExecuteStmt: CREATE OptTemp TABLE ...
# because the warning there is only valid in some situations
if ($flds->[0] ne 'create' || $flds->[2] ne 'table')
{
add_to_buffer('rules',
'mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");' );
}
$feature_not_supported = 0;
}
[Solution]
I have two solutions for this.
1) This problem occurs because filter does not work properly.
So, by setting the filter conditions properly, wrong warning should not be output.
However, we have to modify the conditions when the syntax in gram.y is changed.
2) This problem occurs when a syntax is not supported under certain conditions like following:
So, when "if sentence" is found inside rule, the warning should not be output.
CreateSchemaStmt:
| CREATE SCHEMA IF_P NOT EXISTS OptSchemaName AUTHORIZATION RoleSpec OptSchemaEltList
{
CreateSchemaStmt *n = makeNode(CreateSchemaStmt);
if ($9 != NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("CREATE SCHEMA IF NOT EXISTS cannot include schema elements"),
parser_errposition(@9)));
I attached a draft patch of the solution 2).
Regards,
Daisuke, Higuchi
Attachment | Content-Type | Size |
---|---|---|
ECPG_unsupported_messages_fix_v1.patch | application/octet-stream | 1.6 KB |
test.pgc | application/octet-stream | 666 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2019-10-02 05:30:43 | Re: Revert back to standard AC_STRUCT_TIMEZONE Autoconf macro |
Previous Message | Amit Kapila | 2019-10-02 03:20:44 | Re: dropdb --force |