pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: higuchi.daisuke@jp.fujitsu.com
Subject: BUG #15837: Precompiling embedded SQL applications which are created by SJIS character code is failed.
Date: Thu, 06 Jun 2019 11:49:59 +0000
Message-ID: <15837-5d1f2dbc5db0ef0c@postgresql.org> (raw)

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,



Message-ID: <15837-5d1f2dbc5db0ef0c@postgresql.org>
Permalink:  ../15837-5d1f2dbc5db0ef0c@postgresql.org/
Also on:    postgresql.org/message-id/15837-5d1f2dbc5db0ef0c@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, higuchi.daisuke@jp.fujitsu.com
  Subject: Re: BUG #15837: Precompiling embedded SQL applications which are created by SJIS character code is failed.
  In-Reply-To: <15837-5d1f2dbc5db0ef0c@postgresql.org>
  References: <15837-5d1f2dbc5db0ef0c@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox