Bug #1021 | ResultSetMetaData getColumnType returning incorrect result | ||
---|---|---|---|
Submitted: | 9 Aug 2003 17:17 | Modified: | 9 Dec 2003 7:32 |
Reporter: | robert ryan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 3.08 | OS: | Windows (win 2000) |
Assigned to: | MySQL Verification Team | CPU Architecture: | Any |
[9 Aug 2003 17:17]
robert ryan
[10 Aug 2003 8:56]
Mark Matthews
This is actually a server issue, a packet-level dump of the conversation between the server and the JDBC driver shows what is going on: Field info without 'distinct': 03 73 74 64 04 74 65 73 . s t d . t e s 74 02 54 31 02 54 31 04 t . T 1 . T 1 . 6e 61 6d 65 04 6e 61 6d n a m e . n a m 65 0c 08 00 ff 00 00 00 e . . . . . . . ^--- MySQL field type of VARSTRING == VARCHAR Field info with 'distinct': 03 73 74 64 00 02 54 31 . s t d . . T 1 10 2f 74 6d 70 2f 23 73 . / t m p / # s 71 6c 5f 37 38 36 66 5f q l _ 7 8 6 f _ 30 04 6e 61 6d 65 04 6e 0 . n a m e . n 61 6d 65 0c 08 00 ff 00 a m e . . . . . 00 00 fe 01 00 00 00 00 . . . . . . . . ^--- MySQL field type of 'String' == CHAR The server has created a temporary table to handle the 'distinct' clause, which is expected. However, it hasn't faithfully reproduced all of the column types from the original table. Also, whoever in the server team ends up looking at this bug, notice that the 'original' names have been pulled from the temp table created, where in this case, they really should be from the original table, 'T1', as the temp table creation was implicitly decided by the server, not the user.
[10 Aug 2003 9:01]
Mark Matthews
One correction, the packet dump for the first case looks like (I truncated it accidently): 03 73 74 64 04 74 65 73 . s t d . t e s 74 02 54 31 02 54 31 04 t . T 1 . T 1 . 6e 61 6d 65 04 6e 61 6d n a m e . n a m 65 0c 08 00 ff 00 00 00 e . . . . . . . fd 03 40 00 00 00 00 . . @ . . . . ^--- MySQL field type of VARSTRING == VARCHAR
[9 Dec 2003 7:32]
MySQL Verification Team
Fixed by our CTO in 4.0.15