Tuesday, September 1, 2009

Fun with user variables

What type is used for the expression returned by this SELECT statement?
set @x = 1e300; select @x
It depends:
  • MySQL 4.0, 5.1 - double
  • MySQL 4.1, 5.0 - string
Note that this table uses double in all releases:
set @x = 1e300; create table tt as select @x

3 comments:

  1. Hi!

    just curious - how did you determine the type?

    ReplyDelete
  2. mysql --debug-info or mysql --column-type-info

    ReplyDelete

 
Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.