IDEMPIERE-708 Postgresql ERROR: date/time value current is no longer supported / Role access update broken with clock_timestamp - the correct replacement for oracle sysdate must be statement_timestamp
This commit is contained in:
parent
ab08b3568e
commit
8c0c60a812
|
@ -518,11 +518,11 @@ public final class MRole extends X_AD_Role
|
||||||
if (reset)
|
if (reset)
|
||||||
deleteAccessRecords();
|
deleteAccessRecords();
|
||||||
|
|
||||||
int win = DB.executeUpdate(sqlWindow + roleAccessLevelWin, get_TrxName());
|
int win = DB.executeUpdateEx(sqlWindow + roleAccessLevelWin, get_TrxName());
|
||||||
int proc = DB.executeUpdate(sqlProcess + roleAccessLevel, get_TrxName());
|
int proc = DB.executeUpdateEx(sqlProcess + roleAccessLevel, get_TrxName());
|
||||||
int form = DB.executeUpdate(sqlForm + roleAccessLevel, get_TrxName());
|
int form = DB.executeUpdateEx(sqlForm + roleAccessLevel, get_TrxName());
|
||||||
int wf = DB.executeUpdate(sqlWorkflow + roleAccessLevel, get_TrxName());
|
int wf = DB.executeUpdateEx(sqlWorkflow + roleAccessLevel, get_TrxName());
|
||||||
int docact = DB.executeUpdate(sqlDocAction, get_TrxName());
|
int docact = DB.executeUpdateEx(sqlDocAction, get_TrxName());
|
||||||
|
|
||||||
loadAccess(true);
|
loadAccess(true);
|
||||||
return "@AD_Window_ID@ #" + win
|
return "@AD_Window_ID@ #" + win
|
||||||
|
@ -539,11 +539,11 @@ public final class MRole extends X_AD_Role
|
||||||
private void deleteAccessRecords() {
|
private void deleteAccessRecords() {
|
||||||
String whereDel = " WHERE AD_Role_ID=" + getAD_Role_ID();
|
String whereDel = " WHERE AD_Role_ID=" + getAD_Role_ID();
|
||||||
//
|
//
|
||||||
int winDel = DB.executeUpdate("DELETE FROM AD_Window_Access" + whereDel, get_TrxName());
|
int winDel = DB.executeUpdateEx("DELETE FROM AD_Window_Access" + whereDel, get_TrxName());
|
||||||
int procDel = DB.executeUpdate("DELETE FROM AD_Process_Access" + whereDel, get_TrxName());
|
int procDel = DB.executeUpdateEx("DELETE FROM AD_Process_Access" + whereDel, get_TrxName());
|
||||||
int formDel = DB.executeUpdate("DELETE FROM AD_Form_Access" + whereDel, get_TrxName());
|
int formDel = DB.executeUpdateEx("DELETE FROM AD_Form_Access" + whereDel, get_TrxName());
|
||||||
int wfDel = DB.executeUpdate("DELETE FROM AD_WorkFlow_Access" + whereDel, get_TrxName());
|
int wfDel = DB.executeUpdateEx("DELETE FROM AD_WorkFlow_Access" + whereDel, get_TrxName());
|
||||||
int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access" + whereDel, get_TrxName());
|
int docactDel = DB.executeUpdateEx("DELETE FROM AD_Document_Action_Access" + whereDel, get_TrxName());
|
||||||
|
|
||||||
|
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("AD_Window_Access=" + winDel
|
if (log.isLoggable(Level.FINE)) log.fine("AD_Window_Access=" + winDel
|
||||||
|
|
|
@ -63,11 +63,12 @@ public final class ConvertMap_PostgreSQL {
|
||||||
s_pg.put("\\bBITMAP INDEX\\b", "INDEX");
|
s_pg.put("\\bBITMAP INDEX\\b", "INDEX");
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
s_pg.put("\\bSYSDATE\\b", "clock_timestamp()");
|
s_pg.put("\\bSYSDATE\\b", "statement_timestamp()");
|
||||||
|
s_pg.put("\\bCURRENT_TIMESTAMP\\b", "statement_timestamp()");
|
||||||
//begin vpj-cd e-evolution 03/11/2005 PostgreSQL
|
//begin vpj-cd e-evolution 03/11/2005 PostgreSQL
|
||||||
s_pg.put("\\bDUMP\\b", "MD5");
|
s_pg.put("\\bDUMP\\b", "MD5");
|
||||||
s_pg.put("END CASE", "END");
|
s_pg.put("END CASE", "END");
|
||||||
s_pg.put("\\bgetDate\\b\\(\\)", "clock_timestamp()");
|
s_pg.put("\\bgetDate\\b\\(\\)", "statement_timestamp()");
|
||||||
//end vpj-cd e-evolution 03/11/2005 PostgreSQL
|
//end vpj-cd e-evolution 03/11/2005 PostgreSQL
|
||||||
s_pg.put("\\bNVL\\b", "COALESCE");
|
s_pg.put("\\bNVL\\b", "COALESCE");
|
||||||
s_pg.put("\\bTO_DATE\\b", "TO_TIMESTAMP");
|
s_pg.put("\\bTO_DATE\\b", "TO_TIMESTAMP");
|
||||||
|
|
|
@ -189,7 +189,7 @@ public final class Convert_PostgreSQLTest extends TestCase{
|
||||||
public void testMultiColumnAssignment() {
|
public void testMultiColumnAssignment() {
|
||||||
// Line 407 of ImportProduct.java
|
// Line 407 of ImportProduct.java
|
||||||
sql = "UPDATE M_PRODUCT SET (Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,Updated,UpdatedBy)= (SELECT Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,SysDate,UpdatedBy FROM I_Product WHERE I_Product_ID=?) WHERE M_Product_ID=?";
|
sql = "UPDATE M_PRODUCT SET (Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,Updated,UpdatedBy)= (SELECT Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,SysDate,UpdatedBy FROM I_Product WHERE I_Product_ID=?) WHERE M_Product_ID=?";
|
||||||
sqe = "UPDATE M_PRODUCT SET Value=I_Product.Value,Name=I_Product.Name,Description=I_Product.Description,DocumentNote=I_Product.DocumentNote,Help=I_Product.Help,UPC=I_Product.UPC,SKU=I_Product.SKU,C_UOM_ID=I_Product.C_UOM_ID,M_Product_Category_ID=I_Product.M_Product_Category_ID,Classification=I_Product.Classification,ProductType=I_Product.ProductType,Volume=I_Product.Volume,Weight=I_Product.Weight,ShelfWidth=I_Product.ShelfWidth,ShelfHeight=I_Product.ShelfHeight,ShelfDepth=I_Product.ShelfDepth,UnitsPerPallet=I_Product.UnitsPerPallet,Discontinued=I_Product.Discontinued,DiscontinuedBy=I_Product.DiscontinuedBy,Updated=CURRENT_TIMESTAMP,UpdatedBy=I_Product.UpdatedBy FROM I_Product WHERE I_Product.I_Product_ID=? AND M_PRODUCT.M_Product_ID=?";
|
sqe = "UPDATE M_PRODUCT SET Value=I_Product.Value,Name=I_Product.Name,Description=I_Product.Description,DocumentNote=I_Product.DocumentNote,Help=I_Product.Help,UPC=I_Product.UPC,SKU=I_Product.SKU,C_UOM_ID=I_Product.C_UOM_ID,M_Product_Category_ID=I_Product.M_Product_Category_ID,Classification=I_Product.Classification,ProductType=I_Product.ProductType,Volume=I_Product.Volume,Weight=I_Product.Weight,ShelfWidth=I_Product.ShelfWidth,ShelfHeight=I_Product.ShelfHeight,ShelfDepth=I_Product.ShelfDepth,UnitsPerPallet=I_Product.UnitsPerPallet,Discontinued=I_Product.Discontinued,DiscontinuedBy=I_Product.DiscontinuedBy,Updated=statement_timestamp(),UpdatedBy=I_Product.UpdatedBy FROM I_Product WHERE I_Product.I_Product_ID=? AND M_PRODUCT.M_Product_ID=?";
|
||||||
r = convert.convert(sql);
|
r = convert.convert(sql);
|
||||||
assertEquals(sqe, r[0]);
|
assertEquals(sqe, r[0]);
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ public final class Convert_PostgreSQLTest extends TestCase{
|
||||||
+" WHERE c.AD_Element_ID=e.AD_Element_ID"
|
+" WHERE c.AD_Element_ID=e.AD_Element_ID"
|
||||||
+" AND (c.ColumnName <> e.ColumnName OR c.Name <> e.Name "
|
+" AND (c.ColumnName <> e.ColumnName OR c.Name <> e.Name "
|
||||||
+" OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' ')))";
|
+" OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' ')))";
|
||||||
sqe = "UPDATE AD_COLUMN SET ColumnName=e.ColumnName,Name=e.Name,Description=e.Description,Help=e.Help, Updated = CURRENT_TIMESTAMP FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND (AD_COLUMN.ColumnName <> e.ColumnName OR AD_COLUMN.Name <> e.Name OR COALESCE(AD_COLUMN.Description,' ') <> COALESCE(e.Description,' ') OR COALESCE(AD_COLUMN.Help,' ') <> COALESCE(e.Help,' ')))";
|
sqe = "UPDATE AD_COLUMN SET ColumnName=e.ColumnName,Name=e.Name,Description=e.Description,Help=e.Help, Updated = statement_timestamp() FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND (AD_COLUMN.ColumnName <> e.ColumnName OR AD_COLUMN.Name <> e.Name OR COALESCE(AD_COLUMN.Description,' ') <> COALESCE(e.Description,' ') OR COALESCE(AD_COLUMN.Help,' ') <> COALESCE(e.Help,' ')))";
|
||||||
r = convert.convert(sql);
|
r = convert.convert(sql);
|
||||||
assertEquals(sqe, r[0]);
|
assertEquals(sqe, r[0]);
|
||||||
|
|
||||||
|
@ -420,12 +420,12 @@ public final class Convert_PostgreSQLTest extends TestCase{
|
||||||
|
|
||||||
public void test2371805_GetDate() {
|
public void test2371805_GetDate() {
|
||||||
sql = "SELECT getdate() FROM DUAL";
|
sql = "SELECT getdate() FROM DUAL";
|
||||||
sqe = "SELECT CURRENT_TIMESTAMP";
|
sqe = "SELECT statement_timestamp()";
|
||||||
r = convert.convert(sql);
|
r = convert.convert(sql);
|
||||||
assertEquals(sqe, r[0]);
|
assertEquals(sqe, r[0]);
|
||||||
|
|
||||||
sql = "SELECT SYSDATE FROM DUAL";
|
sql = "SELECT SYSDATE FROM DUAL";
|
||||||
sqe = "SELECT CURRENT_TIMESTAMP";
|
sqe = "SELECT statement_timestamp()";
|
||||||
r = convert.convert(sql);
|
r = convert.convert(sql);
|
||||||
assertEquals(sqe, r[0]);
|
assertEquals(sqe, r[0]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue