AnantLabs / wwwsqldesigner

Automatically exported from code.google.com/p/wwwsqldesigner
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

PostgreSql primary keys not well formed #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create in a PostgreSql database any table with a primary key constraint
2. Load the database in wwwsqldesigner

What is the expected output? What do you see instead?
The CSS class "primary" is not applied over the primary key, so you see the 
row(s) in normal font-weight, not bold.

What version of the product are you using? On what operating system?
2.4 / Chromium / XP

Please provide any additional information below.
Or you can fix the postgresql-specific code, or you can fix the javascript 
code. The problem is that in the XML file there is type="PRIMARY KEY" 
instead of type="PRIMARY".

The patch I choose to make is over the JS file, in the 
SQL.Row.prototype.isPrimary function:
instead of > if (k.getType() == "PRIMARY") { return true; }
i did this > if (k.getType().indexOf("PRIMARY") != -1) { return true; }

(read : if PRIMARY is found in the TYPE string)

Original issue reported on code.google.com by geompse@gmail.com on 11 Mar 2010 at 5:27

GoogleCodeExporter commented 9 years ago
Since "PRIMARY" is used elsewhere, it is a wiser choice to patch the PostgreSQL 
code, 
as it :

before line
 > $xml .= '<key name="'.$keyname.'" type="'.$row2["constraint_type"].'">';

add
 > if ($row2["constraint_type"] == 'PRIMARY KEY') { $row2["constraint_type"] = 
'PRIMARY'; }

Original comment by geompse@gmail.com on 11 Mar 2010 at 5:30

GoogleCodeExporter commented 9 years ago
Fixed in r81.

Original comment by ondrej.zara on 11 Mar 2010 at 5:43