IDEMPIERE-5678 Unit Test is failing with PostgreSQL 15 (#1789)

This commit is contained in:
hengsin 2023-04-19 19:57:34 +08:00 committed by GitHub
parent 449c124fe1
commit eb78bd4ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 37 additions and 37 deletions

View File

@ -343,7 +343,7 @@ public class M_PriceList_Create extends SvrProcess {
/** Calculations **/
MProductPrice[] pp = m_plv.getProductPrice(
"AND EXISTS (SELECT * FROM T_Selection s "
" AND EXISTS (SELECT * FROM T_Selection s "
+ "WHERE s.AD_PInstance_ID = " + m_AD_PInstance_ID + " AND s.T_Selection_ID=M_ProductPrice.M_Product_ID)");
for (MProductPrice price : pp) {
BigDecimal priceList = price.getPriceList();

View File

@ -121,11 +121,11 @@ public class OrderPOCreate extends SvrProcess
.append(" INNER JOIN M_Product_PO po ON (ol.M_Product_ID=po.M_Product_ID) ")
.append("WHERE o.C_Order_ID=ol.C_Order_ID AND po.C_BPartner_ID=?)");
if (p_DateOrdered_From != null && p_DateOrdered_To != null)
sql.append("AND TRUNC(o.DateOrdered) BETWEEN ? AND ?");
sql.append(" AND TRUNC(o.DateOrdered) BETWEEN ? AND ?");
else if (p_DateOrdered_From != null && p_DateOrdered_To == null)
sql.append("AND TRUNC(o.DateOrdered) >= ?");
sql.append(" AND TRUNC(o.DateOrdered) >= ?");
else if (p_DateOrdered_From == null && p_DateOrdered_To != null)
sql.append("AND TRUNC(o.DateOrdered) <= ?");
sql.append(" AND TRUNC(o.DateOrdered) <= ?");
}
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -959,7 +959,7 @@ public class ModelClassGenerator
// complete sql
String filterViews = null;
if (tableLike.toString().contains("%")) {
filterViews = "AND (TableName IN ('RV_WarehousePrice','RV_BPartner') OR IsView='N')"; // special views
filterViews = " AND (TableName IN ('RV_WarehousePrice','RV_BPartner') OR IsView='N')"; // special views
}
if (tableLike.toString().equals("'%'")) {
filterViews += " AND TableName NOT LIKE 'W|_%' ESCAPE '|'"; // exclude webstore from general model generator

View File

@ -817,7 +817,7 @@ public class ModelInterfaceGenerator
// complete sql
String filterViews = null;
if (tableLike.toString().contains("%")) {
filterViews = "AND (TableName IN ('RV_WarehousePrice','RV_BPartner') OR IsView='N')"; // special views
filterViews = " AND (TableName IN ('RV_WarehousePrice','RV_BPartner') OR IsView='N')"; // special views
}
if (tableLike.toString().equals("'%'")) {
filterViews += " AND TableName NOT LIKE 'W|_%' ESCAPE '|'"; // exclude webstore from general model generator

View File

@ -313,7 +313,7 @@ public final class ImpFormat
+ "f.DataFormat,f.DecimalPoint,f.DivideBy100,f.ConstantValue,f.Callout," // 7..11
+ "f.Name, f.importprefix " // 12..13
+ "FROM AD_ImpFormat_Row f,AD_Column c "
+ "WHERE f.AD_ImpFormat_ID=? AND f.AD_Column_ID=c.AD_Column_ID AND f.IsActive='Y'"
+ "WHERE f.AD_ImpFormat_ID=? AND f.AD_Column_ID=c.AD_Column_ID AND f.IsActive='Y' "
+ "ORDER BY f.SeqNo";
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -1840,7 +1840,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
+ " INNER JOIN C_InvoiceLine l ON (o.C_Invoice_ID=l.C_Invoice_ID) "
+ "WHERE o.C_Invoice_ID=? ");
}
sql.append("GROUP BY o.C_Currency_ID, c.ISO_Code, o.TotalLines, o.GrandTotal, o.DateAcct, o.AD_Client_ID, o.AD_Org_ID");
sql.append(" GROUP BY o.C_Currency_ID, c.ISO_Code, o.TotalLines, o.GrandTotal, o.DateAcct, o.AD_Client_ID, o.AD_Org_ID");
if (log.isLoggable(Level.FINE)) log.fine(m_vo.TableName + " - " + Record_ID);
MessageFormat mf = null;

View File

@ -381,7 +381,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
if (local_only_product_id != 0)
sql.append(" AND (M_Locator.IsDefault='Y' ") // Default Locator
.append("OR EXISTS (SELECT * FROM M_Product p ") // Product Locator
.append("WHERE p.M_Locator_ID=M_Locator.M_Locator_ID AND p.M_Product_ID=?)")
.append("WHERE p.M_Locator_ID=M_Locator.M_Locator_ID AND p.M_Product_ID=?) ")
.append("OR EXISTS (SELECT * FROM M_Storage s ") // Storage Locator
.append("WHERE s.M_Locator_ID=M_Locator.M_Locator_ID AND s.M_Product_ID=?))");
m_parsedValidation = null;

View File

@ -489,7 +489,7 @@ public class MMatchPO extends X_M_MatchPO
{
//check m_matchinv not created with different qty
int cnt = DB.getSQLValueEx(sLine.get_TrxName(), "SELECT Count(*) FROM M_MatchInv WHERE M_InOutLine_ID="+sLine.getM_InOutLine_ID()
+" AND C_InvoiceLine_ID="+ matchPO.getC_InvoiceLine_ID() + "AND Qty != ?", retValue.getQty());
+" AND C_InvoiceLine_ID="+ matchPO.getC_InvoiceLine_ID() + " AND Qty != ?", retValue.getQty());
if (cnt <= 0) {
if (!matchPO.isPosted() && matchPO.getQty().compareTo(retValue.getQty()) >=0 ) // greater than or equal quantity
{

View File

@ -1035,7 +1035,7 @@ public class MOrder extends X_C_Order implements DocAction
{
int ii = DB.getSQLValueEx(null,
"SELECT M_PriceList_ID FROM M_PriceList "
+ "WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive=?"
+ "WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive=? "
+ "ORDER BY IsDefault DESC", getAD_Client_ID(), isSOTrx(), true);
if (ii != 0)
setM_PriceList_ID (ii);

View File

@ -2289,7 +2289,7 @@ public class MPayment extends X_C_Payment
counter.setRef_Payment_ID(getC_Payment_ID());
//
String sql = "SELECT C_BankAccount_ID FROM C_BankAccount "
+ "WHERE C_Currency_ID=? AND AD_Org_ID IN (0,?) AND IsActive='Y' AND AD_Client_ID = ?"
+ "WHERE C_Currency_ID=? AND AD_Org_ID IN (0,?) AND IsActive='Y' AND AD_Client_ID = ? "
+ "ORDER BY IsDefault DESC";
int C_BankAccount_ID = DB.getSQLValue(get_TrxName(), sql, getC_Currency_ID(), counterAD_Org_ID,getAD_Client_ID());
counter.setC_BankAccount_ID(C_BankAccount_ID);

View File

@ -504,7 +504,7 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport
+ "(wa.AD_Role_ID=" + getAD_Role_ID()
+ " AND w.AD_Window_ID = wa.AD_Window_ID) "
+ "WHERE w.IsActive = 'Y' AND wa.AD_Window_ID IS NULL AND t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt " // only check first tab
+ "WHERE xt.AD_Window_ID=w.AD_Window_ID)"
+ "WHERE xt.AD_Window_ID=w.AD_Window_ID) "
+ "AND tt.AccessLevel IN ";
String sqlProcess = "INSERT INTO AD_Process_Access "

View File

@ -426,7 +426,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
{
sql += " AND s.QtyOnHand <> 0 ";
}
sql += "ORDER BY l.PriorityNo DESC, DateMaterialPolicy ";
sql += " ORDER BY l.PriorityNo DESC, DateMaterialPolicy ";
if (!FiFo)
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
else
@ -456,13 +456,13 @@ public class MStorageOnHand extends X_M_StorageOnHand
if (minGuaranteeDate != null)
{
sql += "AND (asi.GuaranteeDate IS NULL OR asi.GuaranteeDate>?) ";
sql += " AND (asi.GuaranteeDate IS NULL OR asi.GuaranteeDate>?) ";
}
MProduct product = MProduct.get(Env.getCtx(), M_Product_ID);
if(product.isUseGuaranteeDateForMPolicy()){
sql += "ORDER BY l.PriorityNo DESC, COALESCE(asi.GuaranteeDate,s.DateMaterialPolicy)";
sql += " ORDER BY l.PriorityNo DESC, COALESCE(asi.GuaranteeDate,s.DateMaterialPolicy)";
if (!FiFo)
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
else
@ -470,7 +470,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
}
else
{
sql += "ORDER BY l.PriorityNo DESC, l.M_Locator_ID, s.DateMaterialPolicy";
sql += " ORDER BY l.PriorityNo DESC, l.M_Locator_ID, s.DateMaterialPolicy";
if (!FiFo)
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
else
@ -613,14 +613,14 @@ public class MStorageOnHand extends X_M_StorageOnHand
MProduct product = MProduct.get(Env.getCtx(), M_Product_ID, trxName);
if(product.isUseGuaranteeDateForMPolicy()){
sql += "ORDER BY l.PriorityNo DESC, " +
sql += " ORDER BY l.PriorityNo DESC, " +
"asi.GuaranteeDate";
if (!FiFo)
sql += " DESC";
}
else
{
sql += "ORDER BY l.PriorityNo DESC, l.M_Locator_ID, s.DateMaterialPolicy";
sql += " ORDER BY l.PriorityNo DESC, l.M_Locator_ID, s.DateMaterialPolicy";
if (!FiFo)
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
else

View File

@ -314,7 +314,7 @@ public class DataEngine
+ "','"
+ MPrintFormatItem.PRINTFORMATTYPE_Script
+ "') ")
.append("ORDER BY pfi.IsPrinted DESC, pfi.SeqNo"); // Functions are put in first column
.append(" ORDER BY pfi.IsPrinted DESC, pfi.SeqNo"); // Functions are put in first column
PreparedStatement pstmt = null;
ResultSet rs = null;
try

View File

@ -262,7 +262,7 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
// Display restrictions - Passwords, etc.
+ " AND NOT EXISTS (SELECT * FROM AD_Field f "
+ "WHERE pfi.AD_Column_ID=f.AD_Column_ID"
+ " AND (f.IsEncrypted='Y' OR f.ObscureType IS NOT NULL))"
+ " AND (f.IsEncrypted='Y' OR f.ObscureType IS NOT NULL)) "
+ "ORDER BY SeqNo";
MRole role = MRole.getDefault(getCtx(), false);
PreparedStatement pstmt = null;
@ -912,8 +912,8 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
+ "WHERE IsActive='Y' AND AD_Tab_ID=(SELECT MIN(AD_Tab_ID) FROM AD_Tab WHERE AD_Table_ID=? AND IsActive='Y')"
+ " AND IsEncrypted='N' AND ObscureType IS NULL "
+ " AND AD_Column_ID NOT IN (SELECT pfi.AD_Column_ID FROM AD_PrintFormatItem pfi WHERE pfi.AD_PrintFormat_ID=? AND pfi.AD_Column_ID IS NOT NULL) "
+ " AND (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_ReportView_Column WHERE AD_ReportView_ID=? AND IsActive='Y')"
+ " OR ((SELECT COUNT(*) FROM AD_ReportView_Column WHERE AD_ReportView_ID=? AND IsActive='Y') = 0))"
+ " AND (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_ReportView_Column WHERE AD_ReportView_ID=? AND IsActive='Y') "
+ " OR ((SELECT COUNT(*) FROM AD_ReportView_Column WHERE AD_ReportView_ID=? AND IsActive='Y') = 0)) "
+ "ORDER BY COALESCE(IsDisplayed,'N') DESC, SortNo, SeqNo, Name";
PreparedStatement pstmt = null;
ResultSet rs = null;
@ -956,8 +956,8 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
+ "FROM AD_Column "
+ "WHERE IsActive='Y' AND AD_Table_ID=? "
+ " AND AD_Column_ID NOT IN (SELECT pfi.AD_Column_ID FROM AD_PrintFormatItem pfi WHERE pfi.AD_PrintFormat_ID=? AND pfi.AD_Column_ID IS NOT NULL) "
+ " AND (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_ReportView_Column WHERE AD_ReportView_ID=? AND IsActive='Y')"
+ " OR ((SELECT COUNT(*) FROM AD_ReportView_Column WHERE AD_ReportView_ID=?) = 0 AND IsActive='Y'))"
+ " AND (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_ReportView_Column WHERE AD_ReportView_ID=? AND IsActive='Y') "
+ " OR ((SELECT COUNT(*) FROM AD_ReportView_Column WHERE AD_ReportView_ID=?) = 0 AND IsActive='Y')) "
+ "ORDER BY IsIdentifier DESC, SeqNo, Name";
try
{

View File

@ -198,7 +198,7 @@ public class GenericPaymentExport implements PaymentExport
+ "INNER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID) "
+ "LEFT OUTER JOIN C_Region r ON (a.C_Region_ID=r.C_Region_ID) "
+ "INNER JOIN C_Country cc ON (a.C_Country_ID=cc.C_Country_ID) "
+ "WHERE bp.C_BPartner_ID=?" // #1
+ "WHERE bp.C_BPartner_ID=? " // #1
+ "ORDER BY l.IsBillTo DESC";
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -564,7 +564,7 @@ public class Login
+" WHERE ra.AD_Role_ID=r.AD_Role_ID AND ra.IsActive='Y')) "
+" OR (r.IsUseUserOrgAccess='Y' AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_User_OrgAccess ua"
+" WHERE ua.AD_User_ID=?"
+" AND ua.IsActive='Y')))"
+" AND ua.IsActive='Y'))) "
+ "ORDER BY o.Name";
//
PreparedStatement pstmt = null;

View File

@ -491,8 +491,8 @@ public class RequestProcessor extends AdempiereServer
+ " AND EXISTS ("
+ "SELECT * FROM R_RequestType rt "
+ "WHERE rt.R_RequestType_ID=r.R_RequestType_ID"
+ " AND rt.IsAutoChangeRequest='Y')"
+ "AND EXISTS ("
+ " AND rt.IsAutoChangeRequest='Y') "
+ " AND EXISTS ("
+ "SELECT * FROM R_Group g "
+ "WHERE g.R_Group_ID=r.R_Group_ID"
+ " AND (g.M_BOM_ID IS NOT NULL OR g.M_ChangeNotice_ID IS NOT NULL) )"

View File

@ -393,7 +393,7 @@ public class WLocatorEditor extends WEditor implements EventListener<Event>, Pro
if (getOnly_Product_ID() != 0)
sql.append(" AND (IsDefault='Y' ") // Default Locator
.append("OR EXISTS (SELECT * FROM M_Product p ") // Product Locator
.append("WHERE p.M_Locator_ID=M_Locator.M_Locator_ID AND p.M_Product_ID=?)")
.append("WHERE p.M_Locator_ID=M_Locator.M_Locator_ID AND p.M_Product_ID=?) ")
.append("OR EXISTS (SELECT * FROM M_StorageOnHand s ") // Storage Locator
.append("WHERE s.M_Locator_ID=M_Locator.M_Locator_ID AND s.M_Product_ID=?))");

View File

@ -433,7 +433,7 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
String whereAttributeSet;
if (p_M_AttributeSet_ID > 0)
whereAttributeSet = "AND M_Product_ID IN (SELECT M_Product_ID FROM M_Product WHERE M_AttributeSet_ID="+p_M_AttributeSet_ID+")";
whereAttributeSet = " AND M_Product_ID IN (SELECT M_Product_ID FROM M_Product WHERE M_AttributeSet_ID="+p_M_AttributeSet_ID+")";
else
whereAttributeSet = "";
String sql = MRole.getDefault().addAccessSQL(

View File

@ -192,7 +192,7 @@ public class WFieldRecordInfo extends Window implements EventListener<Event>
// Data
String sql = "SELECT AD_Column_ID, Updated, UpdatedBy, OldValue, NewValue "
+ "FROM AD_ChangeLog "
+ "WHERE AD_Table_ID=? AND Record_ID=? AND AD_Column_ID=?"
+ "WHERE AD_Table_ID=? AND Record_ID=? AND AD_Column_ID=? "
+ "ORDER BY Updated DESC";
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -389,7 +389,7 @@ public class FactReconcile {
String sql = MRole.getDefault().addAccessSQL(
"SELECT ev.C_ElementValue_ID, ev.Value || ' ' || ev.Name FROM C_ElementValue ev", "ev",
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)
+ "AND ev.IsActive='Y' AND ev.IsSummary='N' "
+ " AND ev.IsActive='Y' AND ev.IsSummary='N' "
+ "AND EXISTS (SELECT 1 FROM C_AcctSchema_Element ase "
+ "WHERE ase.C_Element_ID=ev.C_Element_ID AND ase.ElementType='AC' "
+ "AND ase.C_AcctSchema_ID=" + m_C_AcctSchema_ID + " AND ase.AD_Client_ID=" + m_AD_Client_ID + ") "

View File

@ -164,9 +164,9 @@ public abstract class CreateFrom implements ICreateFrom
sql = sql.append(" AND o.M_Warehouse_ID=? ");
}
if (forCreditMemo)
sql = sql.append("ORDER BY o.DateOrdered DESC,o.DocumentNo DESC");
sql = sql.append(" ORDER BY o.DateOrdered DESC,o.DocumentNo DESC");
else
sql = sql.append("ORDER BY o.DateOrdered,o.DocumentNo");
sql = sql.append(" ORDER BY o.DateOrdered,o.DocumentNo");
//
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -214,7 +214,7 @@ public abstract class CreateFromInvoice extends CreateFrom
sql.append(" HAVING l.MovementQty-SUM(COALESCE(mi.Qty, 0)) <>0");
else
sql.append(" HAVING l.MovementQty-SUM(COALESCE(il.QtyInvoiced,0)) <>0");
sql.append("ORDER BY l.Line");
sql.append(" ORDER BY l.Line");
PreparedStatement pstmt = null;
ResultSet rs = null;
try

View File

@ -83,7 +83,7 @@ public class TranslationController
// Fill Language
String sql = "SELECT Name, AD_Language "
+ "FROM AD_Language "
+ "WHERE IsActive='Y' AND (IsSystemLanguage='Y' OR IsBaseLanguage='Y')"
+ "WHERE IsActive='Y' AND (IsSystemLanguage='Y' OR IsBaseLanguage='Y') "
+ "ORDER BY Name";
PreparedStatement pstmt = null;
ResultSet rs = null;