Re: BUG #15637: Problem insert data 【Japanese】

From: Marc Schablewski <ms(at)clickware(dot)de>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15637: Problem insert data 【Japanese】
Date: 2019-02-15 12:15:10
Message-ID: e0078286-6268-73c8-c25c-09656e349f3b@clickware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Am 15.02.2019 um 03:43 schrieb PG Bug reporting form:
> I created table has a column 【"C_VAL" character varying(10)】 after that I
> insert data【'不具合管理報告書': length=24】. It was inserted successfully => this is
> problem.
> * Details:
> -- Step 1: Create table. Data length of "C_VAL" column = 10
> create table "USER02"."T_331_VARCHAR" (
> "ID" numeric not null
> , "C_VAL" character varying(10)
> , primary key ("ID")
> );
> -- Step 2: Check data length. OCTET_LENGTH('不具合管理報告書') = 24
> SELECT OCTET_LENGTH('不具合管理報告書');
> -- Step 3: Insert data. Length '不具合管理報告書' = 24
> INSERT INTO "USER02"."T_331_VARCHAR"("ID", "C_VAL")
> VALUES(1,'不具合管理報告書');
> -- Step 4: Check length of inserted data
> SELECT OCTET_LENGTH("C_VAL"), * FROM "USER02"."T_331_VARCHAR";
> => Why 【Step 3】was successful ?. Can you help me ?
> Thank you !

I think it works because a multibyte character is still considered a single character, even if it is
represented internally with more than one byte. This means your octet_length() can be bigger than
the character length of your string returned by length(). The string in your example is still only 8
characters and should fit into your colum.

Marc

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2019-02-15 13:02:58 Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs
Previous Message Sergei Kornilov 2019-02-15 07:41:58 Re: Bug: Deferred FKey Check Happening on Double Update, Not Single