<?xml version="1.0" encoding="utf-8"?>
<launchpad-bug id="778935">
  <date_last_updated>2012-03-29 13:44:45.110305+00:00</date_last_updated>
  <api_links>
    <bug_api_link>https://api.launchpad.net/1.0/bugs/778935</bug_api_link>
    <bug_owner_link>https://api.launchpad.net/1.0/~pstoev-askmonty</bug_owner_link>
    <milestone_link>https://api.launchpad.net/1.0/maria/+milestone/5.5</milestone_link>
    <linked_branches_collection_link>https://api.launchpad.net/1.0/bugs/778935/linked_branches</linked_branches_collection_link>
    <activity_link>https://api.launchpad.net/1.0/bugs/778935/activity</activity_link>
  </api_links>
  <bug_web_link>https://bugs.launchpad.net/bugs/778935</bug_web_link>
  <owner>Philip Stoev</owner>
  <assignee>Michael Widenius</assignee>
  <milestone_title>Maria 5.5</milestone_title>
  <duplicate_link></duplicate_link>
  <duplicate_bug_id></duplicate_bug_id>
  <title>Different types accepted by CAST() and COLUMN_CREATE()</title>
  <status>Confirmed</status>
  <importance>Low</importance>
  <created>2011-05-07 09:24:44.524636+00:00</created>
  <description>
<![CDATA[The dynamic columns documentation at

http://kb.askmonty.org/v/dynamic-columns

provides a list of data types GET_COLUMN() accepts, as well as the note "Type here can be one of the same ones that you would use in CAST or CONVERT:". However, in practice, the allowed types for CAST and for GET_COLUMN are different and are different from what is specified in the dynamic columns manual.

GET_COLUMN() accepts DOUBLE while CAST does not 
GET_COLUMN() does not accept SIGNED, UNSIGNED, BINARY and CHAR(N)]]>  </description>
  <activities>
    <activity datechanged="2011-05-07T09:24:44.524636+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[]]>      </newvalue>
      <whatchanged>bug</whatchanged>
      <person>Philip Stoev</person>
      <message>added bug</message>
    </activity>
    <activity datechanged="2011-05-07T09:24:52.958125+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[5.3]]>      </newvalue>
      <whatchanged>maria: milestone</whatchanged>
      <person>Philip Stoev</person>
      <message></message>
    </activity>
    <activity datechanged="2011-05-07T09:24:59.662490+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[Michael Widenius (monty)]]>      </newvalue>
      <whatchanged>maria: assignee</whatchanged>
      <person>Philip Stoev</person>
      <message></message>
    </activity>
    <activity datechanged="2011-05-07T09:27:10.287722+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[lp:~maria-captains/maria/5.3-mwl34]]>      </newvalue>
      <whatchanged>branch linked</whatchanged>
      <person>Philip Stoev</person>
      <message></message>
    </activity>
    <activity datechanged="2011-05-10T23:11:15.216784+00:00">
      <oldvalue>
<![CDATA[New]]>      </oldvalue>
      <newvalue>
<![CDATA[Invalid]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Michael Widenius</person>
      <message></message>
    </activity>
    <activity datechanged="2011-05-10T23:11:21.856887+00:00">
      <oldvalue>
<![CDATA[Undecided]]>      </oldvalue>
      <newvalue>
<![CDATA[Low]]>      </newvalue>
      <whatchanged>maria: importance</whatchanged>
      <person>Michael Widenius</person>
      <message></message>
    </activity>
    <activity datechanged="2011-05-11T14:57:25.184152+00:00">
      <oldvalue>
<![CDATA[Different types accepted by CAST() and COLUMN_GET()]]>      </oldvalue>
      <newvalue>
<![CDATA[Different types accepted by CAST() and COLUMN_CREATE()]]>      </newvalue>
      <whatchanged>summary</whatchanged>
      <person>Philip Stoev</person>
      <message></message>
    </activity>
    <activity datechanged="2011-05-11T14:57:27.980133+00:00">
      <oldvalue>
<![CDATA[Invalid]]>      </oldvalue>
      <newvalue>
<![CDATA[Confirmed]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Philip Stoev</person>
      <message></message>
    </activity>
    <activity datechanged="2012-03-21T15:36:39.573703+00:00">
      <oldvalue>
<![CDATA[5.3]]>      </oldvalue>
      <newvalue>
<![CDATA[5.5]]>      </newvalue>
      <whatchanged>maria: milestone</whatchanged>
      <person>Michael Widenius</person>
      <message></message>
    </activity>
    <activity datechanged="2012-03-29T13:44:44.950213+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[dyncol]]>      </newvalue>
      <whatchanged>tags</whatchanged>
      <person>Elena Stepanova</person>
      <message></message>
    </activity>
  </activities>
  <comments>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/778935/comments/1" datecreated="2011-05-10T23:11:06.178007+00:00">
      <person>Michael Widenius</person>
      <subject>
<![CDATA[Re: Different types accepted by CAST() and COLUMN_GET()]]>      </subject>
      <content>
<![CDATA[select cast(1 as double)  works in 5.3-mwl tree;  It was added as part of this worklog.
select column_get(column_create(1, 2), 1 as signed) worked for me. All the other versions should also work as the parsing code in sql_yacc.yy is identical for CAST and COLUMN_GET().
COLUMN_CREATE is still 'different' but is scheduled to be fixed.

I tested the following commands and they worked correctly in 5.3-mwl:

column_get(column_create(1, 2), 1 as signed)
select column_get(column_create(1, 2), 1 as unsigned)
select column_get(column_create(1, 2), 1 as CHAR(5))
select column_get(column_create(1, 2), 1 as BINARY(5));
select column_get(column_create(1, 2), 1 as BINARY)`

I have now updated the documentation about this.
]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/778935/comments/2" datecreated="2011-05-11T14:57:44.470885+00:00">
      <person>Philip Stoev</person>
      <subject>
<![CDATA[Re: Different types accepted by CAST() and COLUMN_CREATE()]]>      </subject>
      <content>
<![CDATA[If there is a part that is "scheduled to be fixed", then this bug remains on the table.]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/778935/comments/3" datecreated="2012-03-21T18:21:35.963355+00:00">
      <person>Elena Stepanova</person>
      <subject>
<![CDATA[Re: Different types accepted by CAST() and COLUMN_CREATE()]]>      </subject>
      <content>
<![CDATA[Also filed in JIRA as MDEV-196]]>      </content>
    </comment>
  </comments>
</launchpad-bug>
