mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix refresh of Synonyms. Fixes #1611
This commit is contained in:
parent
a0aaa80029
commit
c931d715ac
@ -391,10 +391,18 @@ class SynonymView(PGChildNodeView):
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
# Find parent oid to add properly in tree browser
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_parent_oid.sql']),
|
||||
data=data, conn=self.conn)
|
||||
status, parent_id = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
return jsonify(
|
||||
node=self.blueprint.generate_browser_node(
|
||||
data['name'],
|
||||
scid,
|
||||
int(parent_id),
|
||||
data['name'],
|
||||
icon="icon-synonym"
|
||||
)
|
||||
@ -483,25 +491,14 @@ class SynonymView(PGChildNodeView):
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
return make_json_response(
|
||||
success=1,
|
||||
info="Synonym updated",
|
||||
data={
|
||||
'id': syid,
|
||||
'scid': scid,
|
||||
'did': did
|
||||
}
|
||||
)
|
||||
else:
|
||||
return make_json_response(
|
||||
success=1,
|
||||
info="Nothing to update",
|
||||
data={
|
||||
'id': syid,
|
||||
'scid': scid,
|
||||
'did': did
|
||||
}
|
||||
return jsonify(
|
||||
node=self.blueprint.generate_browser_node(
|
||||
syid,
|
||||
scid,
|
||||
syid,
|
||||
icon="icon-synonym"
|
||||
)
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
@ -96,13 +96,13 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
select2: { width: "50%", allowClear: false },
|
||||
options: function(obj) {
|
||||
return [
|
||||
{label: "Table", value: "r"},
|
||||
{label: "Sequence", value: "S"},
|
||||
{label: "View", value: "v"},
|
||||
{label: "Function", value: "f"},
|
||||
{label: "Procedure", value: "p"},
|
||||
{label: "Package", value: "P"},
|
||||
{label: "Public Synonym", value: "s"}
|
||||
{label: "{{ _('Function') }}", value: "f"},
|
||||
{label: "{{ _('Package') }}", value: "P"},
|
||||
{label: "{{ _('Procedure') }}", value: "p"},
|
||||
{label: "{{ _('Public Synonym') }}", value: "s"},
|
||||
{label: "{{ _('Sequence') }}", value: "S"},
|
||||
{label: "{{ _('Table') }}", value: "r"},
|
||||
{label: "{{ _('View') }}", value: "v"}
|
||||
]
|
||||
},
|
||||
control: 'select2'
|
||||
|
@ -0,0 +1,5 @@
|
||||
SELECT synnamespace as scid
|
||||
FROM pg_synonym s
|
||||
WHERE synname = {{ data.name|qtLiteral }}
|
||||
AND synnamespace IN
|
||||
( SELECT oid FROM pg_namespace WHERE nspname = {{ data.schema|qtLiteral }} );
|
@ -0,0 +1,5 @@
|
||||
SELECT synnamespace as scid
|
||||
FROM pg_synonym s
|
||||
WHERE synname = {{ data.name|qtLiteral }}
|
||||
AND synnamespace IN
|
||||
( SELECT oid FROM pg_namespace WHERE nspname = {{ data.schema|qtLiteral }} );
|
Loading…
Reference in New Issue
Block a user