Commit 8d263aab authored by Fran Pregernik's avatar Fran Pregernik Committed by Benjamin Eberlei

Fix for nasty bug that happens when there are 2 or more schemas with tables...

Fix for nasty bug that happens when there are 2 or more schemas with tables that have the same name. Since all the AbstractPlatform classes get only the table name using ALL_* schema tables is dangerous because the owner is never supplied.

The other possible solution is to use the ALL_* tables but in each of the methods to fetch the owner before actualy querying them.
parent 6e87f201
...@@ -480,16 +480,13 @@ END;'; ...@@ -480,16 +480,13 @@ END;';
cols.position, cols.position,
r_alc.table_name \"references_table\", r_alc.table_name \"references_table\",
r_cols.column_name \"foreign_column\" r_cols.column_name \"foreign_column\"
FROM all_cons_columns cols FROM usercons_columns cols
LEFT JOIN all_constraints alc LEFT JOIN user_constraints alc
ON alc.constraint_name = cols.constraint_name ON alc.constraint_name = cols.constraint_name
AND alc.owner = cols.owner LEFT JOIN user_constraints r_alc
LEFT JOIN all_constraints r_alc
ON alc.r_constraint_name = r_alc.constraint_name ON alc.r_constraint_name = r_alc.constraint_name
AND alc.r_owner = r_alc.owner LEFT JOIN user_cons_columns r_cols
LEFT JOIN all_cons_columns r_cols
ON r_alc.constraint_name = r_cols.constraint_name ON r_alc.constraint_name = r_cols.constraint_name
AND r_alc.owner = r_cols.owner
AND cols.position = r_cols.position AND cols.position = r_cols.position
WHERE alc.constraint_name = cols.constraint_name WHERE alc.constraint_name = cols.constraint_name
AND alc.constraint_type = 'R' AND alc.constraint_type = 'R'
...@@ -512,8 +509,8 @@ LEFT JOIN all_cons_columns r_cols ...@@ -512,8 +509,8 @@ LEFT JOIN all_cons_columns r_cols
$ownerCondition = "AND c.owner = '".$database."'"; $ownerCondition = "AND c.owner = '".$database."'";
} }
return "SELECT c.*, d.comments FROM all_tab_columns c ". return "SELECT c.*, d.comments FROM user_tab_columns c ".
"INNER JOIN all_col_comments d ON d.OWNER = c.OWNER AND d.TABLE_NAME = c.TABLE_NAME AND d.COLUMN_NAME = c.COLUMN_NAME ". "INNER JOIN user_col_comments d ON d.TABLE_NAME = c.TABLE_NAME AND d.COLUMN_NAME = c.COLUMN_NAME ".
"WHERE c.table_name = '" . $table . "' ".$ownerCondition." ORDER BY c.column_name"; "WHERE c.table_name = '" . $table . "' ".$ownerCondition." ORDER BY c.column_name";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment