Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0010829Openbravo ERPA. Platformpublic2009-09-30 13:132009-11-20 00:00
networkb 
marvintm 
highminoralways
closedfixed 
20rPath Linux
2.50MP5 
2.50MP9 
Core
No
0010829: process "export database module" incorrect with a procedure in database with text PERFORM
when you run process "export database module" with a procedure in database with text "PERFORM", xml generated is incorrect: xml has twice word "perform"
. create module
. create procedure in BD with text PERFORM:
   sample:
    CREATE OR REPLACE FUNCTION prueba_f(p_pinstance_id character varying)
    RETURNS void AS
    $BODY$ DECLARE
    BEGIN
     perform AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
    END ; $BODY$
    LANGUAGE 'plpgsql' VOLATILE
    COST 100;
    ALTER FUNCTION prueba_f(character varying) OWNER TO tad;

run "ant export.database -Dmodule="nombreModulo"

XML generated is:
<?xml version="1.0"?>
  <database name="FUNCTION PRUEBA_F">
    <function name="PRUEBA_F" type="NULL">
      <parameter name="p_pinstance_id" type="VARCHAR" mode="in">
        <default/>
      </parameter>
      <body><![CDATA[BEGIN

      PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
END PRUEBA_F
]]></body>
    </function>
  </database>

but when you execute
ant update.database -Dmodule="nombreModulo"
error is returned and function is not loaded to database:
.....
SQL Command failed with: ERROR: error de sintaxis en o cerca de «AD_UPDATE_PINSTANCE»
-- END
-- -----------------------------------------------------------------------
-- FUNCTION PRUEBA_F
-- -----------------------------------------------------------------------
CREATE FUNCTION PRUEBA_F(p_pinstance_id IN VARCHAR) RETURNS VOID

AS $BODY$ DECLARE
BEGIN
     perform PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
END ; $BODY$ LANGUAGE plpgsql;
Executed 423 SQL command(s) with 1 error(s)
......

Thanks,
No tags attached.
has duplicate defect 0011271 closed rafaroda Function not created(failed) when installing module. 
Issue History
2009-09-30 13:13networkbNew Issue
2009-09-30 13:13networkbAssigned To => rafaroda
2009-10-01 19:00psarobeStatusnew => scheduled
2009-10-01 19:00psarobeAssigned Torafaroda => marvintm
2009-10-01 19:00psarobefix_in_branch => pi
2009-10-02 16:30marvintmNote Added: 0020673
2009-10-02 16:30marvintmStatusscheduled => feedback
2009-10-02 18:05networkbNote Added: 0020680
2009-10-02 18:05networkbfix_in_branchpi =>
2009-10-02 18:05networkbProposed Solution updated
2009-10-05 07:53rafarodaPriorityimmediate => high
2009-10-05 07:53rafarodaStatusfeedback => scheduled
2009-10-05 16:52marvintmNote Added: 0020711
2009-10-05 16:52marvintmStatusscheduled => feedback
2009-10-06 16:44networkbNote Added: 0020791
2009-10-08 09:32networkbStatusfeedback => new
2009-10-09 09:41psarobeStatusnew => scheduled
2009-10-09 09:41psarobefix_in_branch => pi
2009-10-22 10:04networkbTarget Version2.50MP8 => 2.50MP9
2009-10-22 10:04networkbfix_in_branchpi =>
2009-11-18 10:02hgbotCheckin
2009-11-18 10:02hgbotNote Added: 0021950
2009-11-18 10:02hgbotStatusscheduled => resolved
2009-11-18 10:02hgbotResolutionopen => fixed
2009-11-18 10:02hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/d341fcdd39f918850c53f04fd3e86ed494ec4955 [^]
2009-11-19 16:47shuehnerNote Added: 0022029
2009-11-19 16:47shuehnerStatusresolved => closed
2009-11-20 00:00anonymoussf_bug_id0 => 2900810
2009-12-29 11:21shuehnerRelationship addedrelated to 0011271
2009-12-30 10:05shuehnerRelationship replacedhas duplicate 0011271

Notes
(0020673)
marvintm   
2009-10-02 16:30   
I understand that this problem could happen sometimes. However, this particular example worked for me perfectly (I created the function copy/pasting the CREATE FUNCTION statement in pgadmin, and then did export.database, and the PERFORM statement was gone, which is the correct behaviour).

Can you provide me with a working example in which this problem happens?
(0020680)
networkb   
2009-10-02 18:05   
sorry, the steps to reproduce the error were not correct.
I have updated this steps.
Thanks
(0020711)
marvintm   
2009-10-05 16:52   
Thanks for the additional steps to reproduce the error. However, the crucial part of it is still missing. The example PL/SQL code you provided works fine (in any 2.50 version, just create the function and export.database, and the "PERFORM" keyword will _not_ appear).

I know that you encountered this problem sometime, so if you could provide me with the exact code for the function that doesn't work, it would be great, because it's a hard issue to reproduce.

The important thing to note is that the function provided, as it is, _does_ work.
(0020791)
networkb   
2009-10-06 16:44   
I have the problem with that function in my enviroment test with 250mp5.
The partner has reported the problem with c_invoice_create function.

Thanks
(0021950)
hgbot   
2009-11-18 10:02   
Repository: erp/devel/pi
Changeset: d341fcdd39f918850c53f04fd3e86ed494ec4955
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Tue Nov 17 10:37:29 2009 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/d341fcdd39f918850c53f04fd3e86ed494ec4955 [^]

Fixed issue 10829. Export.database will not export PL functions with the 'PERFORM' keyword included in the xml file.

---
M src-db/database/build.xml
M src-db/database/lib/dbsourcemanager.jar
---
(0022029)
shuehner   
2009-11-19 16:47   
Tested with the function shown in steps to reproduce, that normal update.databse and export.database to update and export this function without errors. As the resolution for this issue did remove the -Dmodule option from export.database this is enough to fix the issue.