<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — MYSQL 8 ERROR (on Ver 2.3.25)]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=9683</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=9683&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in MYSQL 8 ERROR (on Ver 2.3.25).]]></description>
		<lastBuildDate>Sun, 20 Feb 2022 04:56:06 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: MYSQL 8 ERROR (on Ver 2.3.25)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=40655#p40655</link>
			<description><![CDATA[<p>Hi APMuthu,</p><p>Thanks very much for your suggestions.&nbsp; <br />I&#039;m not sure the issues I mentioned with the extra &quot;)&quot; and &quot;(&quot; can resolve the issue.</p><p>I will give it a try when I set up a test server.&nbsp; &nbsp;Due to the urgency, we have decided to down grade the OS from ubuntu 20.04 to ubuntu 18.04.&nbsp; Ubuntu 18.04 comes default with mysql 5.7 and there is no issue.</p><p>I will post my findings here once I have a chance to verify it.</p><p>/Mark</p>]]></description>
			<author><![CDATA[null@example.com (mark0300)]]></author>
			<pubDate>Sun, 20 Feb 2022 04:56:06 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=40655#p40655</guid>
		</item>
		<item>
			<title><![CDATA[Re: MYSQL 8 ERROR (on Ver 2.3.25)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=40650#p40650</link>
			<description><![CDATA[<p><strong>0_grn_batch.delivery_date</strong> has a DEFAULT of <strong>0000-00-00</strong> which is acceptable in MySQL 5.x but in MySQL 8, a setting in the my.ini is necessary to override it&#039;s rejection.</p><p>A dumb solution would be:<br /></p><div class="codebox"><pre><code>SET sql_mode = &#039;allow_invalid_dates&#039;;</code></pre></div><p>Alternatively in /etc/my.cnf, add the following:<br /></p><div class="codebox"><pre><code>sql-mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION </code></pre></div><p>and restart MySQL.</p><br /><br /><p>References:<br />https://gokhan.ozar.net/blog/how-to-fix-incorrect-datetime-value-mysql-mariadb/<br />https://dba.stackexchange.com/questions/20638/dates-changed-to-0000-00-00<br />https://developpaper.com/problems-with-mysql-8-0-13-setting-date-0000-00-000000/</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 17 Feb 2022 04:19:20 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=40650#p40650</guid>
		</item>
		<item>
			<title><![CDATA[MYSQL 8 ERROR (on Ver 2.3.25)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=40614#p40614</link>
			<description><![CDATA[<p>Sorry to open an issue on version 2.3.25.&nbsp; This issue is related to mysql 8.&nbsp; &nbsp;One of my 2 installations is 2.3.25 and the other one is 2.4.&nbsp; We did not upgrade this 2.3.25 to 2.4 because we have some customizations done to this version and we couldn&#039;t convert the customization to 2.4.&nbsp; It has been running well without issues on Centos 7, mysql 5.7 until we upgraded our server to Ubuntu 20.04 and Mysql 8 recently.&nbsp; I search thru&#039; the forum and I found a similar issue in the forum but without a solution:</p><p>https://frontaccounting.com/punbb/post.php?tid=1977</p><p>Below is the error similar to the above thread (Note the highlight in Blue and Red):<br />-------<br />error code : 1064<br />error message : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#039;) LIMIT 0, 33&#039; at line 35</p><p>SELECT * FROM ((SELECT trans.type, trans.trans_no, trans.reference, supplier.supp_name, trans.supp_reference, trans.tran_date, trans.due_date, supplier.curr_code, (trans.ov_amount + trans.ov_gst + trans.ov_discount) AS TotalAmount, trans.alloc AS Allocated, ((trans.type = 20 OR trans.type = 21) AND trans.due_date &lt; &#039;2022-02-06&#039;) AS OverDue, (ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc &lt;= 0.004) AS Settled FROM 0_supp_trans as trans, 0_suppliers as supplier WHERE <strong><span class="bbu"><span style="color: blue">(supplier.supplier_id = trans.supplier_id</span></span></strong> AND trans.tran_date &gt;= &#039;2022-01-07&#039; AND trans.tran_date &lt;= &#039;2022-02-06&#039; AND trans.ov_amount != 0) UNION (SELECT 25 as type, trans.id as trans_no, trans.reference, supplier.supp_name, po.requisition_no AS supp_reference, delivery_date as tran_date, &#039;&#039; as due_date, supplier.curr_code, &#039;&#039; AS TotalAmount, &#039;&#039; AS Allocated, 0 as OverDue, 1 as Settled FROM 0_grn_batch as trans, 0_suppliers as supplier, 0_purch_orders as po WHERE supplier.supplier_id = trans.supplier_id AND trans.purch_order_no = po.order_no AND trans.delivery_date &gt;= &#039;2022-01-07&#039; <strong><span class="bbu"><span style="color: red">AND trans.delivery_date &lt;= &#039;2022-02-06&#039;)) as tr) LIMIT 0, 20</span></span></strong><br />--------</p><p>After some research and tests, I found 2 issues (highlighted in blue and red in the error message) in the codes but I couldn&#039;t resolve it because it does not seem to be straight forward.</p><p>I found that the program codes can be run on mysql 5.7 without any problem, but when it runs on mysql 8, it produced a syntax error.&nbsp; </p><p><strong>Issue 1:</strong></p><p>I don&#039;t understand why a &quot;(&quot; was produced before the supplier.supplier_id.&nbsp; (refer to the error message which I highlited in blue).&nbsp; </p><p>In this file /purchasing/includes/db/supp_trans_db.inc, this code does not have &quot;(&quot; after WHERE.</p><p>function get_sql_for_supplier_inquiry($filter, $after_date, $to_date, $supplier_id=ALL_TEXT)<br />{<br />&nbsp; &nbsp; $date_after = date2sql($after_date);<br />&nbsp; &nbsp; $date_to = date2sql($to_date);</p><p>&nbsp; &nbsp; $sql = &quot;SELECT trans.type, <br />&nbsp; &nbsp; &nbsp; &nbsp; trans.trans_no,<br />&nbsp; &nbsp; &nbsp; &nbsp; trans.reference, <br />&nbsp; &nbsp; &nbsp; &nbsp; supplier.supp_name, <br />&nbsp; &nbsp; &nbsp; &nbsp; trans.supp_reference,<br />&nbsp; &nbsp; &nbsp; &nbsp; trans.tran_date, <br />&nbsp; &nbsp; &nbsp; &nbsp; trans.due_date,<br />&nbsp; &nbsp; &nbsp; &nbsp; supplier.curr_code, <br />&nbsp; &nbsp; &nbsp; &nbsp; (trans.ov_amount + trans.ov_gst&nbsp; + trans.ov_discount) AS TotalAmount, <br />&nbsp; &nbsp; &nbsp; &nbsp; trans.alloc AS Allocated,<br />&nbsp; &nbsp; &nbsp; &nbsp; ((trans.type = &quot;.ST_SUPPINVOICE.&quot; OR trans.type = &quot;.ST_SUPPCREDIT.&quot;) AND trans.due_date &lt; &#039;&quot; . date2sql(Today()) . &quot;&#039;) AS OverDue,<br />&nbsp; &nbsp; &nbsp; &nbsp; (ABS(trans.ov_amount + trans.ov_gst&nbsp; + trans.ov_discount) - trans.alloc &lt;= &quot;.FLOAT_COMP_DELTA.&quot;) AS Settled<br />&nbsp; &nbsp; &nbsp; &nbsp; FROM &quot;.TB_PREF.&quot;supp_trans as trans, &quot;.TB_PREF.&quot;suppliers as supplier<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; WHERE <strong><span class="bbu">supplier.supplier_id = trans.supplier_id</span></strong> <strong><span style="color: red"> &lt;---- it produced a &quot;(&quot; before supplier-supplier_id (don&#039;t know why?&nbsp; See the error code above) and that caused a syntax error behind. </span></strong><br />&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; AND trans.tran_date &gt;= &#039;$date_after&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; AND trans.tran_date &lt;= &#039;$date_to&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; AND trans.ov_amount != 0&quot;;&nbsp; &nbsp; // exclude voided transactions<br />&nbsp; &nbsp; &nbsp; &nbsp; <br /><strong>Issue 2:</strong></p><p>A &quot;)&quot; was produced after the &quot;as tr)&quot;.&nbsp; I couldn&#039;t find this &quot;)&quot; in the code.</p><p>&nbsp; &nbsp; if (($filter == &#039;6&#039;)) <br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sql = $sql2;<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; elseif (!isset($filter) || $filter == ALL_TEXT || $filter == &#039;6&#039;) {<br />&nbsp; &nbsp; &nbsp; &nbsp; $sql = &quot;SELECT * FROM (($sql) UNION ($sql2)) <strong><span class="bbu"><span style="color: red">as tr&quot;; &lt;--- a &quot;)&quot; was produced here after &quot;as tr&quot;. </span></span></strong> <br />&nbsp; &nbsp;&nbsp; &nbsp; }</p><p>After searching thru&#039; the relevant codes, I couldn&#039;t find how these 2 &quot;(&quot; and &quot;)&quot; were produced. If I could find them, I could just modify the codes to fix the problems.&nbsp; I would appreciate if anyone could help me on this.</p><p>I found that there are some changes made to 2.4 on the above file and when it is run on mysql 8, it does not produce such issue.&nbsp; &nbsp;I attempted to copy those changes to 2.3.25, but yet I couldn&#039;t solve the issue.</p><p>Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (mark0300)]]></author>
			<pubDate>Sun, 06 Feb 2022 04:58:52 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=40614#p40614</guid>
		</item>
	</channel>
</rss>
