Peter Gulutzan wrote:
> Perhaps the confusion is caused by the use of names like 'val_ascii'.
> Since digits and basic punctuation are all in the ascii repertoire, it's
> of course
> true that the result happens to be in ascii. It also happens to be in
> latin2, or
> any other 8-bit character set that MySQL supports. If somebody wants to
> say "this value is ascii", that's fine, and trivial, and has nothing to
> do with
> the worklog task requirement.
Peter, Sergei, and Bar
I owe you all an apology. After reading the above, and experimenting
with the patch, I finally understood what Bar has been trying to tell
me all the time. Part of the problem was that I did not quite
understand what ascii repertoire meant. I now understand that the
val_str_ascii methods is an optimization used on intermediate results
that are guaranteed to only contain ascii.
On the other hand, my experiments revealed a change of behavior: The
collation reported to the client for types that are not strings have
changed. Is this OK?
Below some examples are shown (default character set is latin2).
With 2649 patch Without 2649 patch
=============== ===================
mysql> select 1; mysql> select 1;
Field 1: `1` Field 1: `1`
Catalog: `def` Catalog: `def`
Database: `` Database: ``
Table: `` Table: ``
Org_table: `` Org_table: ``
Type: LONGLONG Type: LONGLONG
Collation: latin2_general_ci (9) Collation: binary (63)
Length: 1 Length: 1
Max_length: 1 Max_length: 1
Decimals: 0 Decimals: 0
Flags: NOT_NULL NUM Flags: NOT_NULL BINARY NUM
+---+ +---+
| 1 | | 1 |
+---+ +---+
| 1 | | 1 |
+---+ +---+
1 row in set (0.00 sec) 1 row in set (0.00 sec)
mysql> select curdate(); mysql> select curdate();
Field 1: `curdate()` Field 1: `curdate()`
Catalog: `def` Catalog: `def`
Database: `` Database: ``
Table: `` Table: ``
Org_table: `` Org_table: ``
Type: DATE Type: DATE
Collation: latin2_general_ci (9) Collation: binary (63)
Length: 10 Length: 10
Max_length: 10 Max_length: 10
Decimals: 0 Decimals: 0
Flags: NOT_NULL Flags: NOT_NULL BINARY
+------------+ +------------+
| curdate() | | curdate() |
+------------+ +------------+
| 2009-07-03 | | 2009-07-03 |
+------------+ +------------+
1 row in set (0.00 sec) 1 row in set (0.00 sec)
mysql> select INET_ATON('10.10.0.1'); mysql> select INET_ATON('10.10.0.1');
Field 1: `INET_ATON('10.10.0.1')` Field 1: `INET_ATON('10.10.0.1')`
Catalog: `def` Catalog: `def`
Database: `` Database: ``
Table: `` Table: ``
Org_table: `` Org_table: ``
Type: LONGLONG Type: LONGLONG
Collation: latin2_general_ci (9) Collation: binary (63)
Length: 21 Length: 21
Max_length: 9 Max_length: 9
Decimals: 0 Decimals: 0
Flags: UNSIGNED NUM Flags: UNSIGNED BINARY NUM
+------------------------+ +------------------------+
| INET_ATON('10.10.0.1') | | INET_ATON('10.10.0.1') |
+------------------------+ +------------------------+
| 168427521 | | 168427521 |
+------------------------+ +------------------------+
1 row in set (0.00 sec) 1 row in set (0.00 sec)
mysql> mysql>
--
Øystein