BUG #15837: Precompiling embedded SQL applications which are created by SJIS character code is failed.

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: higuchi(dot)daisuke(at)jp(dot)fujitsu(dot)com
Subject: BUG #15837: Precompiling embedded SQL applications which are created by SJIS character code is failed.
Date: 2019-06-06 11:49:59
Message-ID: 15837-5d1f2dbc5db0ef0c@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

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

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2019-06-06 14:40:11 Re: Test suite fails on macOS after update to 9.6.13 and 11.3
Previous Message Prakash Ramakrishnan 2019-06-06 09:42:31 space issue in 11 server