Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0021817Openbravo ERPY. DBSourceManagerpublic2012-10-01 17:212012-10-30 15:47
mirurita 
AugustoMauch 
normalmajoralways
closedfixed 
20Community Appliance
pi 
3.0MP17 
marvintm
Core
No
0021817: export.database WRONG_TYPE validation result in a false positive
follow steps to reproduce.

+++++++++++++++++++++++++++++++++++++++++++++++++++
Errors for Validation type: WRONG_TYPE
+++++++++++++++++++++++++++++++++++++++++++++++++++
Column OBCNTR_UNBILLED_REVENUE.STARTDATE has incorrect type, expecting TIMESTAMP but was NVARCHAR
Column OBCNTR_UNBILLED_REVENUE.DATEACCT has incorrect type, expecting TIMESTAMP but was NVARCHAR
Module validation failed, see the above list of errors for more information
1) Create a new table as follows

CREATE TABLE obcntr_unbilled_revenue
(
  obcntr_unbilled_revenue_id character varying(32) NOT NULL,
  ad_client_id character varying(32) NOT NULL,
  ad_org_id character varying(32) NOT NULL,
  isactive character(1) NOT NULL DEFAULT 'Y'::bpchar,
  created timestamp without time zone NOT NULL DEFAULT now(),
  createdby character varying(32) NOT NULL,
  updated timestamp without time zone NOT NULL DEFAULT now(),
  updatedby character varying(32) NOT NULL,
  "name" character varying(60),
  c_doctype_id character varying(32) NOT NULL,
  documentno character varying(30) NOT NULL,
  startdate timestamp without time zone NOT NULL,
  enddate timestamp without time zone NOT NULL,
  c_currency_id character varying(32) NOT NULL,
  description character varying(255),
  dateacct timestamp without time zone NOT NULL,
  posted character varying(60) NOT NULL DEFAULT 'N'::character varying,
  processing character(1),
  processed character(1) NOT NULL DEFAULT 'N'::bpchar,
  c_project_id character varying(32),
  amount numeric,
  CONSTRAINT obcntr_unbill_rev_key PRIMARY KEY (obcntr_unbilled_revenue_id),
  CONSTRAINT obcntr_unbilled_revenue_client FOREIGN KEY (ad_client_id)
      REFERENCES ad_client (ad_client_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT obcntr_unbill_rev_ad_org FOREIGN KEY (ad_org_id)
      REFERENCES ad_org (ad_org_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT obcntr_unbill_rev_currency FOREIGN KEY (c_currency_id)
      REFERENCES c_currency (c_currency_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT obcntr_unbill_rev_doctype FOREIGN KEY (c_doctype_id)
      REFERENCES c_doctype (c_doctype_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT obcntr_unbill_rev_project FOREIGN KEY (c_project_id)
      REFERENCES c_project (c_project_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT obcntr_unbillrev_isactive_chk CHECK (isactive = ANY (ARRAY['Y'::bpchar, 'N'::bpchar])),
  CONSTRAINT obcntr_unbillrev_proc_chk CHECK (processed = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))
)
WITH (
  OIDS=FALSE
);
COMMENT ON COLUMN obcntr_unbilled_revenue.documentno IS '--OBTG:NVARCHAR--';
COMMENT ON COLUMN obcntr_unbilled_revenue.description IS '--OBTG:NVARCHAR--';

2) Create corresponding table/columns in the application dictionary.

3) ant export.database works fine at this point

4) Drop "name" column and create again with a comment
alter table obcntr_unbilled_revenue drop column name;
alter table obcntr_unbilled_revenue add column name character varying(60) NOT NULL;
COMMENT ON COLUMN obcntr_unbilled_revenue.name IS '--OBTG:NVARCHAR--';

5) ant export.database

+++++++++++++++++++++++++++++++++++++++++++++++++++
Errors for Validation type: WRONG_TYPE
+++++++++++++++++++++++++++++++++++++++++++++++++++
Column OBCNTR_UNBILLED_REVENUE.STARTDATE has incorrect type, expecting TIMESTAMP but was NVARCHAR
Column OBCNTR_UNBILLED_REVENUE.DATEACCT has incorrect type, expecting TIMESTAMP but was NVARCHAR
Module validation failed, see the above list of errors for more information
No tags attached.
diff issue21817.diff (2,103) 2012-10-02 17:49
https://issues.openbravo.com/file_download.php?file_id=5625&type=bug
Issue History
2012-10-01 17:21miruritaNew Issue
2012-10-01 17:21miruritaAssigned To => marvintm
2012-10-01 17:21miruritaModules => Core
2012-10-01 17:34marvintmAssigned Tomarvintm => AugustoMauch
2012-10-02 10:12miruritaDescription Updatedbug_revision_view_page.php?rev_id=3924#r3924
2012-10-02 10:12miruritaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=3926#r3926
2012-10-02 17:49AugustoMauchStatusnew => scheduled
2012-10-02 17:49AugustoMauchfix_in_branch => pi
2012-10-02 17:49AugustoMauchFile Added: issue21817.diff
2012-10-08 13:23AugustoMauchIssue Monitored: marvintm
2012-10-08 13:23AugustoMauchReview Assigned To => marvintm
2012-10-08 13:23AugustoMauchfix_in_branchpi =>
2012-10-09 13:22hgbotCheckin
2012-10-09 13:22hgbotNote Added: 0053169
2012-10-09 13:22hgbotStatusscheduled => resolved
2012-10-09 13:22hgbotResolutionopen => fixed
2012-10-09 13:22hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/7b0840da8515ea4965820dafce053ee3e4ce4b88 [^]
2012-10-09 13:30hgbotCheckin
2012-10-09 13:30hgbotNote Added: 0053171
2012-10-09 13:31AugustoMauchNote Added: 0053172
2012-10-09 13:31AugustoMauchStatusresolved => new
2012-10-09 13:31AugustoMauchResolutionfixed => open
2012-10-10 09:48hgbotCheckin
2012-10-10 09:48hgbotNote Added: 0053187
2012-10-10 09:48hgbotStatusnew => resolved
2012-10-10 09:48hgbotResolutionopen => fixed
2012-10-10 09:48hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/7b0840da8515ea4965820dafce053ee3e4ce4b88 [^] => http://code.openbravo.com/erp/devel/pi/rev/fbfe1fab2cff4b7bd54e461c851b18efc4c64762 [^]
2012-10-10 09:51hgbotCheckin
2012-10-10 09:51hgbotNote Added: 0053188
2012-10-10 09:51hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/fbfe1fab2cff4b7bd54e461c851b18efc4c64762 [^] => http://code.openbravo.com/erp/devel/dbsm-main/rev/c16422ac65dcd5dd39c1e1d2618f588f1d061bfa [^]
2012-10-11 07:50hudsonbotCheckin
2012-10-11 07:50hudsonbotNote Added: 0053277
2012-10-11 07:51hudsonbotCheckin
2012-10-11 07:51hudsonbotNote Added: 0053279
2012-10-11 07:51hudsonbotCheckin
2012-10-11 07:51hudsonbotNote Added: 0053287
2012-10-30 15:47marvintmStatusresolved => closed
2012-10-30 15:47marvintmFixed in Version => 3.0MP17

Notes
(0053169)
hgbot   
2012-10-09 13:22   
Repository: erp/devel/pi
Changeset: 7b0840da8515ea4965820dafce053ee3e4ce4b88
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Oct 09 11:00:46 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/7b0840da8515ea4965820dafce053ee3e4ce4b88 [^]

Fixes issue 21817: SQL comments are applied to the proper columns

There was a problem in postgreSQL that happened when a table was created and one of its columns was removed and created again. The ordinal position of the columns in that case is not consecute, i.e.

Before removing the column:
Ordinal position Name
1 Column1
2 Column2
3 Column3

After removing the column Column2
Ordinal position Name
1 Column1
3 Column3

After adding the column Column2 again
Ordinal position Name
1 Column1
3 Column3
4 Column2

When the comments are applied to the columns, instead of using the ordinal position, the index (1..number of columns) was used to determine which comment belongs to each column. This resulted that the comments were applied to the wrong columns. If instead of using the index the ordinal position is used, the problem is solved.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0053171)
hgbot   
2012-10-09 13:30   
Repository: erp/devel/pi
Changeset: 52411effe1115298f271e47b162a19b1d0fe4f86
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Oct 09 13:29:28 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/52411effe1115298f271e47b162a19b1d0fe4f86 [^]

Related to issue 21817: Reverted changeset 18172 until it passes Try

---
M src-db/database/lib/dbsourcemanager.jar
---
(0053172)
AugustoMauch   
2012-10-09 13:31   
Fix backed out because first it has to be tested in Try
(0053187)
hgbot   
2012-10-10 09:48   
Repository: erp/devel/pi
Changeset: fbfe1fab2cff4b7bd54e461c851b18efc4c64762
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Oct 10 09:47:15 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/fbfe1fab2cff4b7bd54e461c851b18efc4c64762 [^]

Fixes issue 21817: SQL comments are applied to the proper columns

There was a problem in postgreSQL that happened when a table was created and one of its columns was removed and created again. The ordinal position of the columns in that case is not consecute, i.e.

Before removing the column:
Ordinal position Name
1 Column1
2 Column2
3 Column3

After removing the column Column2
Ordinal position Name
1 Column1
3 Column3

After adding the column Column2 again
Ordinal position Name
1 Column1
3 Column3
4 Column2

When the comments are applied to the columns, instead of using the ordinal position, the index (1..number of columns) was used to determine which comment belongs to each column. This resulted that the comments were applied to the wrong columns. If instead of using the index the ordinal position is used, the problem is solved.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0053188)
hgbot   
2012-10-10 09:51   
Repository: erp/devel/dbsm-main
Changeset: c16422ac65dcd5dd39c1e1d2618f588f1d061bfa
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Oct 08 13:33:02 2012 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/c16422ac65dcd5dd39c1e1d2618f588f1d061bfa [^]

Fixes issue 21817: SQL comments are applied to the proper columns

There was a problem in postgreSQL that happened when a table was created and one of its columns was removed and created again. The ordinal position of the columns in that case is not consecute, i.e.

Before removing the column:
Ordinal position Name
1 Column1
2 Column2
3 Column3

After removing the column Column2
Ordinal position Name
1 Column1
3 Column3

After adding the column Column2 again
Ordinal position Name
1 Column1
3 Column3
4 Column2

When the comments are applied to the columns, instead of using the ordinal position, the index (1..number of columns) was used to determine which comment belongs to each column. This resulted that the comments were applied to the wrong columns. If instead of using the index the ordinal position is used, the problem is solved.

---
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java
---
(0053277)
hudsonbot   
2012-10-11 07:50   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/63dfc135f2a1 [^]

Maturity status: Test
(0053279)
hudsonbot   
2012-10-11 07:51   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/63dfc135f2a1 [^]

Maturity status: Test
(0053287)
hudsonbot   
2012-10-11 07:51   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/63dfc135f2a1 [^]

Maturity status: Test