<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>MySQL views datatype mismatch</title><link>https://community.appian.com/discussions/f/data/12025/mysql-views-datatype-mismatch</link><description>Hi, 
 
 I&amp;#39;m facing issue in views due to this bug https://bugs.mysql.com/bug.php?id=61131 . 
 While publishing datastore I&amp;#39;m gettting error (The data source schema does not match the type mappings: Wrong column type in XXXXXXX_View for column XXXXX. Found</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: MySQL views datatype mismatch</title><link>https://community.appian.com/thread/53292?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 17:47:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:feb5a31a-a1a3-450e-9ab9-ac3ff831f4b9</guid><dc:creator>josep</dc:creator><description>&lt;p&gt;I thought you already had it and/or&amp;nbsp;you didn&amp;#39;t wanted to touch the CDTs!!&lt;/p&gt;
&lt;p&gt;this is Great!! I am glad you found the problem!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; Jose&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MySQL views datatype mismatch</title><link>https://community.appian.com/thread/53273?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 13:11:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0d2f04c6-c3c4-4eed-88f9-1996182c50e3</guid><dc:creator>riyazs</dc:creator><description>Thanks . Issue resolved by placing column definition &amp;quot;tinyint(1)&amp;quot;.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MySQL views datatype mismatch</title><link>https://community.appian.com/thread/53220?ContentTypeID=1</link><pubDate>Thu, 08 Mar 2018 22:29:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bb80aa25-996e-4773-86d7-3bdc93d493ef</guid><dc:creator>josep</dc:creator><description>In that case because of that bug i don&amp;#39;t think you have too much options, well you have a lot but some are not that easy. &lt;br /&gt;
1) Correct the error recompile the MySQL :)&lt;br /&gt;
2) wait until they fix it&lt;br /&gt;
3) change the database &lt;br /&gt;
just kidding  =D , but still an option &lt;br /&gt;
&lt;br /&gt;
you have to decide what do you prefer , extra proccesing? extra memory? extra space? update code?&lt;br /&gt;
4) update the CDT&amp;#39;s &lt;br /&gt;
5) recreate all your current views with a preffix &amp;quot;_pre&amp;quot; or post fix &amp;quot;pre_&amp;quot; and create the view with calling the function. &lt;br /&gt;
6) change your design, instead using 2 tables and a union put everything in the same table. &lt;br /&gt;
&lt;br /&gt;
7) create the union your send in another table&lt;br /&gt;
7a) bulk both tables in 1 table (no union)  and the new table will have a type to differentiate between the two tables&lt;br /&gt;
7b) then add triggers on DELETE, UPDATE,  INSERT and apply the changes to the new table (remember the type)&lt;br /&gt;
7c) change the view to query the new table&lt;br /&gt;
&lt;br /&gt;
I can try to think about more options. But now i am getting curious why you are doing unions which affect you that much, maybe if you tell us your use case or the problem we can even suggest some other options. &lt;br /&gt;
&lt;br /&gt;
in your CDT you specified &amp;quot;tinyint(1)&amp;quot; as the type in the column annotation?&lt;br /&gt;
&lt;br /&gt;
Hope this helps&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MySQL views datatype mismatch</title><link>https://community.appian.com/thread/53219?ContentTypeID=1</link><pubDate>Thu, 08 Mar 2018 20:52:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f9859af6-bd40-4aa9-953c-43124909bbda</guid><dc:creator>riyazs</dc:creator><description>Thanks josep.  It works fine.&lt;br /&gt;
&lt;br /&gt;
But, I&amp;#39;m looking if we can update the existing one instead of creating a new one because we have a bunch of views impacted.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MySQL views datatype mismatch</title><link>https://community.appian.com/thread/53208?ContentTypeID=1</link><pubDate>Thu, 08 Mar 2018 17:58:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c4c86b5a-241b-4ca7-8a07-d42a0e2dad0e</guid><dc:creator>josep</dc:creator><description>&lt;p&gt;Hello Riyazs,&lt;/p&gt;
&lt;p&gt;So, I understand you still have a boolean value in that field it is just converted to a tinyint(4).&lt;/p&gt;
&lt;p&gt;you cannot use the cast because tinyint is not allowed but can you create a new view and a function?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;From the link you refer&amp;nbsp;they are creating this:&lt;/p&gt;
&lt;p&gt;- create or replace view la_luis_view2 as &amp;nbsp;select * from la_luis_view1 union all select &amp;nbsp;* as X from la_luis_view1;&lt;/p&gt;
&lt;p&gt;I will rewrite it like this:&lt;/p&gt;
&lt;p&gt;- create or replace view la_luis_view2 as select especie_de_boolean from la_luis_view1 union all select &amp;nbsp;especie_de_boolean as X from la_luis_view1;&lt;/p&gt;
&lt;p&gt;then create the following&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;DELIMITER $$
CREATE FUNCTION `IntToTinyInt1`(TheInt tinyint) 
RETURNS tinyint(1) -- here is the trick
DETERMINISTIC
BEGIN
RETURN TheInt;
END$$
DELIMITER ;

create or replace view la_luis_view3 as 
select IntToTinyInt1(especie_de_boolean)  from la_luis_view2;
desc la_luis_view3;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(If you want to see the thread&amp;nbsp;&amp;nbsp;&lt;a href="https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert"&gt;https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Jose&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>