Fix refreshing of Unique constraints. Fixes #1893
parent
8c48be3b0c
commit
67e5dfa5a7
|
@ -398,9 +398,13 @@ class IndexConstraintView(PGChildNodeView):
|
||||||
"""
|
"""
|
||||||
SQL = render_template("/".join([self.template_path, 'nodes.sql']),
|
SQL = render_template("/".join([self.template_path, 'nodes.sql']),
|
||||||
cid=cid,
|
cid=cid,
|
||||||
|
tid=tid,
|
||||||
constraint_type=self.constraint_type)
|
constraint_type=self.constraint_type)
|
||||||
status, rset = self.conn.execute_2darray(SQL)
|
status, rset = self.conn.execute_2darray(SQL)
|
||||||
|
|
||||||
|
if not status:
|
||||||
|
return internal_server_error(errormsg=rset)
|
||||||
|
|
||||||
if len(rset['rows']) == 0:
|
if len(rset['rows']) == 0:
|
||||||
return gone(_("""Could not find the {} in the table.""".format(
|
return gone(_("""Could not find the {} in the table.""".format(
|
||||||
"primary key" if self.constraint_type == "p" else "unique key"
|
"primary key" if self.constraint_type == "p" else "unique key"
|
||||||
|
@ -439,6 +443,9 @@ class IndexConstraintView(PGChildNodeView):
|
||||||
constraint_type=self.constraint_type)
|
constraint_type=self.constraint_type)
|
||||||
status, rset = self.conn.execute_2darray(SQL)
|
status, rset = self.conn.execute_2darray(SQL)
|
||||||
|
|
||||||
|
if not status:
|
||||||
|
return internal_server_error(errormsg=rset)
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
for row in rset['rows']:
|
for row in rset['rows']:
|
||||||
|
|
|
@ -11,4 +11,7 @@ LEFT JOIN pg_depend dep ON (dep.classid = cls.tableoid AND
|
||||||
LEFT OUTER JOIN pg_constraint con ON (con.tableoid = dep.refclassid AND
|
LEFT OUTER JOIN pg_constraint con ON (con.tableoid = dep.refclassid AND
|
||||||
con.oid = dep.refobjid)
|
con.oid = dep.refobjid)
|
||||||
WHERE indrelid = {{tid}}::oid
|
WHERE indrelid = {{tid}}::oid
|
||||||
AND contype='{{constraint_type}}'
|
AND contype='{{constraint_type}}'
|
||||||
|
{% if cid %}
|
||||||
|
AND cls.oid = {{cid}}::oid
|
||||||
|
{% endif %}
|
Loading…
Reference in New Issue