Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Revisions: Issue #27453 All Revisions ] Back to Issue ]
Summary 0027453: pl function c_project_generate has broken sql
Revision 2014-08-24 14:09 by shuehner
Description This functions contains the following sql:
182 SELECT COALESCE(MAX(C_UOM_ID), '100'),
183 MAX(C_Tax_ID) -- UOM 100=EA
184 INTO v_C_UOM_ID,
185 v_C_Tax_ID
186 FROM M_PRODUCT p,
187 C_TAX t
188 WHERE P.C_TaxCategory_ID=t.C_TaxCategory_ID
189 AND P.M_Product_ID=CUR_PLines.M_Product_ID
190 ORDER BY t.IsDefault DESC;

Note: line numbers as per \sf+ c_project_generate

This sql is broken as leads to the following error when executed 'with some random product':
obpi93=# SELECT COALESCE(MAX(C_UOM_ID), '100'),
  MAX(C_Tax_ID) -- UOM 100=EA
FROM M_PRODUCT p,
  C_TAX t
WHERE P.C_TaxCategory_ID=t.C_TaxCategory_ID
  AND P.M_Product_ID='0DC5C5281B3643DEAB978EB04139516B'
ORDER BY t.IsDefault DESC;
ERROR: column "t.isdefault" must appear in the GROUP BY clause or be used in an aggregate function
LINE 7: ORDER BY t.IsDefault DESC;

Note: This code seems to be unchanged since hg-revision 0 (from 2007)

Note: similar bug technically as in 27452.
That sql also functionally is questionable as either the order by is useless or the code is functionally wrong.
Revision 2014-08-24 14:08 by shuehner
Description This functions contains the following sql:
182 SELECT COALESCE(MAX(C_UOM_ID), '100'),
183 MAX(C_Tax_ID) -- UOM 100=EA
184 INTO v_C_UOM_ID,
185 v_C_Tax_ID
186 FROM M_PRODUCT p,
187 C_TAX t
188 WHERE P.C_TaxCategory_ID=t.C_TaxCategory_ID
189 AND P.M_Product_ID=CUR_PLines.M_Product_ID
190 ORDER BY t.IsDefault DESC;

Note: line numbers as per \sf+ c_project_generate

This sql is broken as leads to the following error when executed 'with some random product':
obpi93=# SELECT COALESCE(MAX(C_UOM_ID), '100'),
  MAX(C_Tax_ID) -- UOM 100=EA
FROM M_PRODUCT p,
  C_TAX t
WHERE P.C_TaxCategory_ID=t.C_TaxCategory_ID
  AND P.M_Product_ID='0DC5C5281B3643DEAB978EB04139516B'
ORDER BY t.IsDefault DESC;
ERROR: column "t.isdefault" must appear in the GROUP BY clause or be used in an aggregate function
LINE 7: ORDER BY t.IsDefault DESC;

Note: This code seems to be unchanged since hg-revision 0 (from 2007)


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker