Re: [HACKERS] [PATCHES] character type value is not padded with spaces

2005-05-23 Thread Tatsuo Ishii
Hackers,

The problem he found is not only existing in Japanese characters but
also in any multibyte encodings including UTF-8. For me the patch
looks good and I will commit it to 7.3, 7.4, 8.0 stables and current
if there's no objection.
--
Tatsuo Ishii

 Character type value including multibyte characters is not padded
 with spaces. It reproduces at 7.3.x, 7.4.x and 8.0.x.
 
create table t (a char(10));
insert into t values ('X'); -- X is 2byte character.
 
 I expect that 'X ' is inserted. But 'X' is inserted.
 
select a, octed_length(a) from t;
 
   a   | octet_length 
---+--
 X |   10
 
 If padded with spaces, octet_length(a) is 15. This problem is caused
 that string length is calculated by byte length(VARSIZE) in
 exprTypmod().
 
 I attache the patch for this problem.
 
 Regards,
 
 --
 Yoshiyuki Asaba
 [EMAIL PROTECTED]

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [HACKERS] [PATCHES] character type value is not padded with spaces

2005-05-23 Thread John Hansen
Ahemm,...

UNICODE DB:

create table t (a char(10));
set client_encoding = iso88591;
insert into t VALUES ('æøå');

select a, octet_length(a),length(a) from t;
 a  | octet_length | length
+--+
 æøå|   13 |  3
(1 row)

This is with 8.0.2.

Just FYI.

... John

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Tatsuo Ishii
 Sent: Tuesday, May 24, 2005 8:52 AM
 To: [EMAIL PROTECTED]
 Cc: pgsql-patches@postgresql.org; pgsql-hackers@postgresql.org
 Subject: Re: [PATCHES] character type value is not padded with spaces
 
 Hackers,
 
 The problem he found is not only existing in Japanese 
 characters but also in any multibyte encodings including 
 UTF-8. For me the patch looks good and I will commit it to 
 7.3, 7.4, 8.0 stables and current if there's no objection.
 --
 Tatsuo Ishii
 
  Character type value including multibyte characters is not 
 padded with 
  spaces. It reproduces at 7.3.x, 7.4.x and 8.0.x.
  
 create table t (a char(10));
 insert into t values ('X'); -- X is 2byte character.
  
  I expect that 'X ' is inserted. But 'X' is inserted.
  
 select a, octed_length(a) from t;
  
a   | octet_length 
 ---+--
  X |   10
  
  If padded with spaces, octet_length(a) is 15. This problem 
 is caused 
  that string length is calculated by byte length(VARSIZE) in 
  exprTypmod().
  
  I attache the patch for this problem.
  
  Regards,
  
  --
  Yoshiyuki Asaba
  [EMAIL PROTECTED]
 
 ---(end of 
 broadcast)---
 TIP 2: you can get off all lists at once with the unregister command
 (send unregister YourEmailAddressHere to 
 [EMAIL PROTECTED])
 
 

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] [PATCHES] character type value is not padded with spaces

2005-05-23 Thread John Hansen
Ahhh... 

 -Original Message-
 From: Tatsuo Ishii [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, May 24, 2005 9:26 AM
 To: John Hansen
 Cc: [EMAIL PROTECTED]; pgsql-patches@postgresql.org; 
 pgsql-hackers@postgresql.org
 Subject: Re: [PATCHES] character type value is not padded with spaces
 
 I think you need to test with 5 characters, not 3.
 --
 Tatsuo Ishii
 
  Ahemm,...
  
  UNICODE DB:
  
  create table t (a char(10));
  set client_encoding = iso88591;
  insert into t VALUES ('æøå');
  
  select a, octet_length(a),length(a) from t;
   a  | octet_length | length
  +--+
   æøå|   13 |  3
  (1 row)
  
  This is with 8.0.2.
  
  Just FYI.
  
  ... John
  
   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On Behalf Of Tatsuo 
   Ishii
   Sent: Tuesday, May 24, 2005 8:52 AM
   To: [EMAIL PROTECTED]
   Cc: pgsql-patches@postgresql.org; pgsql-hackers@postgresql.org
   Subject: Re: [PATCHES] character type value is not padded with 
   spaces
   
   Hackers,
   
   The problem he found is not only existing in Japanese 
 characters but 
   also in any multibyte encodings including UTF-8. For me the patch 
   looks good and I will commit it to 7.3, 7.4, 8.0 stables 
 and current 
   if there's no objection.
   --
   Tatsuo Ishii
   
Character type value including multibyte characters is not
   padded with
spaces. It reproduces at 7.3.x, 7.4.x and 8.0.x.

   create table t (a char(10));
   insert into t values ('X'); -- X is 2byte character.

I expect that 'X ' is inserted. But 'X' is inserted.

   select a, octed_length(a) from t;

  a   | octet_length 
   ---+--
X |   10

If padded with spaces, octet_length(a) is 15. This problem
   is caused
that string length is calculated by byte length(VARSIZE) in 
exprTypmod().

I attache the patch for this problem.

Regards,

--
Yoshiyuki Asaba
[EMAIL PROTECTED]
   
   ---(end of
   broadcast)---
   TIP 2: you can get off all lists at once with the 
 unregister command
   (send unregister YourEmailAddressHere to
   [EMAIL PROTECTED])
   
   
  
 
 

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [HACKERS] [PATCHES] character type value is not padded with spaces

2005-05-23 Thread Tatsuo Ishii
I think you need to test with 5 characters, not 3.
--
Tatsuo Ishii

 Ahemm,...
 
 UNICODE DB:
 
 create table t (a char(10));
 set client_encoding = iso88591;
 insert into t VALUES ('æøå');
 
 select a, octet_length(a),length(a) from t;
  a  | octet_length | length
 +--+
  æøå|   13 |  3
 (1 row)
 
 This is with 8.0.2.
 
 Just FYI.
 
 ... John
 
  -Original Message-
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of Tatsuo Ishii
  Sent: Tuesday, May 24, 2005 8:52 AM
  To: [EMAIL PROTECTED]
  Cc: pgsql-patches@postgresql.org; pgsql-hackers@postgresql.org
  Subject: Re: [PATCHES] character type value is not padded with spaces
  
  Hackers,
  
  The problem he found is not only existing in Japanese 
  characters but also in any multibyte encodings including 
  UTF-8. For me the patch looks good and I will commit it to 
  7.3, 7.4, 8.0 stables and current if there's no objection.
  --
  Tatsuo Ishii
  
   Character type value including multibyte characters is not 
  padded with 
   spaces. It reproduces at 7.3.x, 7.4.x and 8.0.x.
   
  create table t (a char(10));
  insert into t values ('X'); -- X is 2byte character.
   
   I expect that 'X ' is inserted. But 'X' is inserted.
   
  select a, octed_length(a) from t;
   
 a   | octet_length 
  ---+--
   X |   10
   
   If padded with spaces, octet_length(a) is 15. This problem 
  is caused 
   that string length is calculated by byte length(VARSIZE) in 
   exprTypmod().
   
   I attache the patch for this problem.
   
   Regards,
   
   --
   Yoshiyuki Asaba
   [EMAIL PROTECTED]
  
  ---(end of 
  broadcast)---
  TIP 2: you can get off all lists at once with the unregister command
  (send unregister YourEmailAddressHere to 
  [EMAIL PROTECTED])
  
  
 

---(end of broadcast)---
TIP 8: explain analyze is your friend