Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0040842Openbravo ERPA. Platformpublic2019-05-10 16:152019-05-27 17:33
shuehner 
alostale 
normalmajorhave not tried
closedfixed 
5
 
3.0PR19Q3 
caristu
Core
No
0040842: Error on create.database with PG12 (prescript views user_constraints + user_tab_columns) use removed attributes
Running ant create.database against PG12 (devel) has 2 views from prescript-PostgreSql.sql failing to create

a.) user_constraint

[createdatabase] 3737 [main] WARN org.apache.ddlutils.platform.PGStandardBatchEvaluator - SQL Command failed with: ERROR: column pg_constraint.consrc doe
[createdatabase] Hint: Perhaps you meant to reference the column "pg_constraint.conkey" or the column "pg_constraint.conbin".
[createdatabase] Position: 1513

b.) user_tab_columns
[createdatabase] 3752 [main] WARN org.apache.ddlutils.platform.PGStandardBatchEvaluator - SQL Command failed with: ERROR: column pg_attrdef.adsrc does no
[createdatabase] Position: 1450
-
- Check if the 2 internal views which are created to match existing oracle system views can be removed
- If not they need to be adapted to work with the removed postgres system catalog attributes

Known users:
1.) At least the user_constraints view is used in ErrorTextParser_data.xsql/.java file
2.) postgrescript function ad_script_drop_recreate_index
That function should probably be removed.
Afaik never called automatically and at least on postgres 'reindex' command exists to do the same
Note that removal could cascade to utility table ad_script_sql -> however that could be used by modules (even if basic structure for the table some years ago was used as 'useful' in some customer scripts
3.) SessionFactoryController
- usage could be maybe rewritten
4.) AD_ALERTRULE 'Disabled constraints': 1000008, isactive=N
- Should probably be more a compile time tool then alert
- Similar to related alertrule
- careful that is adrd not ad
No tags attached.
related to defect 0040843 closed alostale update.database "Reading tables..." fails with PG12 -> pg_attrdef.adsrc does not exists 
blocks feature request 0040841 closed shuehner support PostgreSQL 12 
Issue History
2019-05-10 16:15shuehnerNew Issue
2019-05-10 16:15shuehnerAssigned To => platform
2019-05-10 16:15shuehnerModules => Core
2019-05-10 16:15shuehnerTriggers an Emergency Pack => No
2019-05-10 16:16shuehnerRelationship addedblocks 0040841
2019-05-10 16:35shuehnerNote Added: 0111628
2019-05-10 16:36shuehnerRelationship addedrelated to 0040843
2019-05-13 12:52alostaleAssigned Toplatform => alostale
2019-05-13 12:53alostaleReview Assigned To => caristu
2019-05-13 12:55hgbotCheckin
2019-05-13 12:55hgbotNote Added: 0111640
2019-05-13 12:55hgbotStatusnew => resolved
2019-05-13 12:55hgbotResolutionopen => fixed
2019-05-13 12:55hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/19bd63f27cc6971c671fb623a1e2cb56450727df [^]
2019-05-13 14:41hgbotCheckin
2019-05-13 14:41hgbotNote Added: 0111643
2019-05-21 15:17hudsonbotCheckin
2019-05-21 15:17hudsonbotNote Added: 0112027
2019-05-21 15:17hudsonbotCheckin
2019-05-21 15:17hudsonbotNote Added: 0112029
2019-05-27 17:33caristuNote Added: 0112180
2019-05-27 17:33caristuStatusresolved => closed
2019-05-27 17:33caristuFixed in Version => 3.0PR19Q3

Notes
(0111628)
shuehner   
2019-05-10 16:35   
For first issue:
https://git.postgresql.org/gitweb/?p=postgresql.git&a=search&h=HEAD&st=commit&s=consrc [^]

Apparently the consrc attribute is deprecated since 2003 and a pg-function is available as replacement since back then.

for 2nd case:
https://git.postgresql.org/gitweb/?p=postgresql.git&a=search&h=HEAD&st=commit&s=consrc [^]

Similarly was marked as 'should not be used' with a catalog function available.

Good news:
If those replacement functions can be used and are available long time no conditional needs to be added to support old/new postgres.
(0111640)
hgbot   
2019-05-13 12:55   
Repository: erp/devel/pi
Changeset: 19bd63f27cc6971c671fb623a1e2cb56450727df
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon May 13 12:47:39 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/19bd63f27cc6971c671fb623a1e2cb56450727df [^]

fixed bug 40842: install.source fails with PostgreSQL 12

  It was failing on prescript creation as it makes use of two columns that have
  been removed in PostgreSQL 12 (pg_attrdef.adsrc, pg_constraint.consrc).

  They have been replaced by pg_get_expr and pg_get_constraintdef functions which
  are present in all supported PG versions.

---
M src-db/database/model/prescript-PostgreSql.sql
---
(0111643)
hgbot   
2019-05-13 14:41   
Repository: erp/devel/pi
Changeset: 39feb7c057960887a8ab266c4b8f69844255403c
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon May 13 14:40:35 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/39feb7c057960887a8ab266c4b8f69844255403c [^]

related to issue 40842: fixes dba_getstandard_search_text

  pg_get_constraintdef includes "CHECK()" to check conditions, remove it to keep
  backwards compatibility

---
M src-db/database/model/prescript-PostgreSql.sql
---
(0112027)
hudsonbot   
2019-05-21 15:17   
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/9b8f37d9d85e [^]
Maturity status: Test
(0112029)
hudsonbot   
2019-05-21 15:17   
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/9b8f37d9d85e [^]
Maturity status: Test
(0112180)
caristu   
2019-05-27 17:33   
Reviewed + tested OK.

Executed also DBSMTestSuite without errors.