public inbox for [email protected]
help / color / mirror / Atom feedFrom: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM 2069 - Wrong tablespace displayed in table properties
Date: Fri, 13 Jan 2017 12:11:32 +0530
Message-ID: <CAFOhELfYpisg_bE+ndopMw7kirReqhLJQk1wKPpWwUmq3H3dzg@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
Please find the attached patch to fix the RM 2069 - Wrong tablespace
displayed in table properties.
When the table is created without a tablespace, the "pg_default" tablespace
gets selected rather than the default tablespace (the current database
tablespace).
So, this issue has been fixed.
Thanks,
Khushboo
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[text/x-patch] RM_2069.patch (9.2K, 3-RM_2069.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index 99fa00c..64657b1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -134,7 +134,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
- This function is used to return modified SQL for the selected
Table node
- * get_sql(data, scid, tid)
+ * get_sql(did, scid, tid, data)
- This function will generate sql from model data
* sql(gid, sid, did, scid, tid):
@@ -344,7 +344,8 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
"""
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, datlastsysoid=self.datlastsysoid)
+ did=did, scid=scid,
+ datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -1128,7 +1129,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -1498,7 +1499,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
data[k] = v
try:
- SQL, name = self.get_sql(scid, tid, data)
+ SQL, name = self.get_sql(did, scid, tid, data)
SQL = SQL.strip('\n').strip(' ')
status, res = self.conn.execute_scalar(SQL)
@@ -1547,7 +1548,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
try:
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -1608,7 +1609,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
try:
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -1656,7 +1657,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
try:
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -1736,7 +1737,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
data[k] = v
try:
- SQL, name = self.get_sql(scid, tid, data)
+ SQL, name = self.get_sql(did, scid, tid, data)
SQL = re.sub('\n{2,}', '\n\n', SQL)
SQL = SQL.strip('\n')
if SQL == '':
@@ -2104,7 +2105,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
else:
return None
- def get_sql(self, scid, tid, data):
+ def get_sql(self, did, scid, tid, data):
"""
This function will generate create/update sql from model data
coming from client
@@ -2112,7 +2113,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
if tid is not None:
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -2468,7 +2469,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
"""
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -2738,7 +2739,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
"""
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -2782,7 +2783,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
"""
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -2829,7 +2830,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
"""
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@@ -2878,7 +2879,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
"""
SQL = render_template("/".join([self.template_path,
'properties.sql']),
- scid=scid, tid=tid,
+ did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql
index d995d00..a16cf87 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql
@@ -1,5 +1,9 @@
SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS relacl_str,
- (CASE WHEN length(spc.spcname) > 0 THEN spc.spcname ELSE 'pg_default' END) as spcname,
+ (CASE WHEN length(spc.spcname) > 0 THEN spc.spcname ELSE
+ (SELECT sp.spcname FROM pg_database dtb
+ JOIN pg_tablespace sp ON dtb.dattablespace=sp.oid
+ WHERE dtb.oid = {{ did }}::oid)
+ END) as spcname,
(select nspname FROM pg_namespace WHERE oid = {{scid}}::oid ) as schema,
pg_get_userbyid(rel.relowner) AS relowner, rel.relhasoids,
rel.relhassubclass, rel.reltuples, des.description, con.conname, con.conkey,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql
index d995d00..a16cf87 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql
@@ -1,5 +1,9 @@
SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS relacl_str,
- (CASE WHEN length(spc.spcname) > 0 THEN spc.spcname ELSE 'pg_default' END) as spcname,
+ (CASE WHEN length(spc.spcname) > 0 THEN spc.spcname ELSE
+ (SELECT sp.spcname FROM pg_database dtb
+ JOIN pg_tablespace sp ON dtb.dattablespace=sp.oid
+ WHERE dtb.oid = {{ did }}::oid)
+ END) as spcname,
(select nspname FROM pg_namespace WHERE oid = {{scid}}::oid ) as schema,
pg_get_userbyid(rel.relowner) AS relowner, rel.relhasoids,
rel.relhassubclass, rel.reltuples, des.description, con.conname, con.conkey,
view thread (12+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin4][Patch]: RM 2069 - Wrong tablespace displayed in table properties
In-Reply-To: <CAFOhELfYpisg_bE+ndopMw7kirReqhLJQk1wKPpWwUmq3H3dzg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox