#1262 Querying CHAR fields using MySql Syntax

closed-invalid
nobody
None
1
2013-12-30
2012-10-26
Mark Bonano
No

If a table is created with of field of type CHAR of a defined length as follows:

create table myTable (id char(36) not null, version integer, creationDate timestamp not null)

And the CHAR field is defined in a simple SELECT query as follows:

SELECT id FROM myTable

Only the first character of the field value is returned. In essence, the field is treated as a CHAR, not a CHAR(36).

Discussion

  • Mark Bonano
    Mark Bonano
    2012-10-26

    • priority: 5 --> 9
     
  • Fred Toussi
    Fred Toussi
    2012-10-27

    set database sql syntax mys
    create table myTable (id char(36) not null, version integer, creationDate timestamp not null)
    insert into mytable values 'Some Text', 2, current_timestamp
    select id from mytable

    ID VERSION CREATIONDATE
    ------------------------------------ ------- -----------------------
    Some Text 2 2012-10-27 01:11:35.828

     
  • Fred Toussi
    Fred Toussi
    2012-10-27

    See the example I just added. It works as you would expect, returning the full text.

     
  • Fred Toussi
    Fred Toussi
    2012-11-01

    This report looks invalid.
    Please check and provide an example if you are really getting the wrong output.

     
  • Fred Toussi
    Fred Toussi
    2012-11-01

    • priority: 9 --> 1
    • status: open --> open-invalid
     
  • Fred Toussi
    Fred Toussi
    2013-12-30

    • status: open-invalid --> closed-invalid