Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #20947 _pgFieldFlags fails in postgres 9.4 with multiple schemas (fix included)
Submitted: 2015-09-11 15:39 UTC
From: pyrliu Assigned:
Status: Open Package: DB_DataObject
PHP Version: 5.5.29 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 22 - 20 = ?

 
 [2015-09-11 15:39 UTC] pyrliu (Pyry Liukas)
Description: ------------ I use DB_DataObject and the generator produced wrong sequence keys + multiple flags + wrong flags for fields. Debugged and noticed that the $tableWhere query in _pgFieldFlags was missing a join with pg_type: //code producing wrong result $tableWhere = "tab.relname = '$table' AND tab.relnamespace = nsp.oid AND nsp.nspname = '$schema'"; //code producing correct result $tableWhere = "tab.relname = '$table' AND tab.relnamespace = nsp.oid AND nsp.nspname = '$schema' AND typ.typnamespace = nsp.oid"; My setup is Postgres 9.4 with 30+ schemas. The actual result was that it included all flags that came when the query is run without the 'AND typ.typnamespace = nsp.oid' join. Just FYI about this fix for those who experience this problem. I have everything working now as I am overloading the DB_DataObject generator and have implemented my own fixes. Expected result: ---------------- //id 'not_null default_nextval%28SCHEMA.SEQUENCE%29 primary_key' //no flags '' //unique not null field 'not_null unique' Actual result: -------------- //id 'not_null default_nextval%28SCHEMA.SEQUENCE%29 primary_key primary_key primary_key primary_key primary_key primary_key primary_key primary_key' //no flags 'unique' //unique not null field 'not_null unique unique unique unique unique unique unique unique'

Comments

 [2018-07-20 18:15 UTC] ashnazg (Chuck Burgess)
-Package: DB +Package: DB_DataObject