PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15837
PG Version11.3
OSWindows 10
Opened2019-06-06 11:49:59+00
Reported bydaisuke higuchi
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15837
Logged by:          daisuke higuchi
Email address:      (redacted)
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,

Messages

DateAuthorSubject
2019-06-06 11:49:59+00PG Bug reporting formBUG #15837: Precompiling embedded SQL applications which are created by SJIS character code is failed.