The following bug has been logged on the website:
Bug reference: 15837
Logged by: daisuke higuchi
Email address: higuchi.daisuke@jp.fujitsu.com
PostgreSQL version: 11.3
Operating system: Windows 10
Description:
Precompiling some embedded SQL applications which are created by SJIS
character code is failed.
SJIS (*1) is general character code on Japanese Windows OS, so I expected
that precompiling is succeeded.
I show the sample application code and the error message.
(1)
When trying to precompile the following application,
"test_sjis_printf.pgc:9: ERROR: unterminated quoted identifier" is output:
[test_sjis_printf.pgc]
----------------------------------------------------------------
#include <stdio.h>
int main()
{
printf("表");
EXEC SQL CONNECT TO tcp:postgresql://localhost:5432/postgres AS con1
USER postgres/postgres;
EXEC SQL DISCONNECT;
return 0;
}
----------------------------------------------------------------
(2)
When trying to precompile the following application, "test_sjis_sql.pgc:11:
ERROR: syntax error at or near ";"" is output:
[test_sjis_sql.pgc]
----------------------------------------------------------------
#include <stdio.h>
EXEC SQL BEGIN DECLARE SECTION;
char tmpstr[1024];
EXEC SQL END DECLARE SECTION;
int
main()
{
EXEC SQL CONNECT TO tcp:postgresql://localhost:5432/postgres AS con1
USER postgres/postgres;
EXEC SQL select * INTO :tmpstr from 端;
printf("values = %s \n", tmpstr);
EXEC SQL DISCONNECT;
return 0;
}
----------------------------------------------------------------
If above application is created with UTF-8 character set, precompiling is
succeeded.
So, I think ecpg precompiler could not deal with SJIS character set
properly.
- The character "表" is represented by 2 bytes "95 5C", so I think
precompiler recognize the second byte is backslash.
- The character "端" is represented by 2 bytes "92 5B", so I think
precompiler recognize the second byte is '['.
(*1) https://en.wikipedia.org/wiki/Shift_JIS
Regards,