Ensure that the user should be able to select/modify tablespace for the partitioned table on v12 and above. Fixes #4950.

This commit is contained in:
Akshay Joshi 2020-01-06 17:45:25 +05:30
parent 2979424db5
commit 82c2d50885
5 changed files with 8 additions and 17 deletions

View File

@ -30,6 +30,7 @@ Bug fixes
| `Issue #4633 <https://redmine.postgresql.org/issues/4633>`_ - Added support to view multilevel partitioned tables.
| `Issue #4842 <https://redmine.postgresql.org/issues/4842>`_ - Ensure that constraints, indexes, rules, triggers, and compound triggers should be created on partitions.
| `Issue #4943 <https://redmine.postgresql.org/issues/4943>`_ - Added more information to the 'Database connected/disconnected' message.
| `Issue #4950 <https://redmine.postgresql.org/issues/4950>`_ - Ensure that the user should be able to select/modify tablespace for the partitioned table on v12 and above.
| `Issue #4999 <https://redmine.postgresql.org/issues/4999>`_ - Rename some internal environment variables that could conflict with Kubernetes.
| `Issue #5004 <https://redmine.postgresql.org/issues/5004>`_ - Fix vulnerability issues reported by 'yarn audit'. Replace the deprecated uglifyjs-webpack-plugin with a terser-webpack-plugin.
| `Issue #5008 <https://redmine.postgresql.org/issues/5008>`_ - Ensure that the error message should not be displayed if Tablespace is not selected while creating the index.

View File

@ -354,18 +354,6 @@ define('pgadmin.node.table', [
return true;
}
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
m.node_info.server.version >= 120000 &&
m.get('is_partitioned')) {
setTimeout( function() {
m.set('spcname', undefined);
}, 10);
return true;
}
return false;
},
},{

View File

@ -75,7 +75,7 @@ CACHE {{c.seqcache|int}} {% endif %}
{% if data.like_relation or data.coll_inherits or data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 or data.check_constraint|length > 0 or data.exclude_constraint|length > 0 %}
){% endif %}{% if data.relkind is defined and data.relkind == 'p' %} PARTITION BY {{ data.partition_scheme }} {% endif %}
{% if not data.coll_inherits and (not data.spcname or (data.spcname and data.is_partitioned)) and not with_clause %};{% endif %}
{% if not data.coll_inherits and not data.spcname and not with_clause %};{% endif %}
{### If we are inheriting it from another table(s) ###}
{% if data.coll_inherits %}
@ -103,11 +103,9 @@ WITH (
toast.{{opt.name}} = {{opt.value}}{% endif %}
{% endfor %}{% endif %}
{% if data.spcname and not data.is_partitioned %}){% else %});{% endif %}
{% endif %}
{### SQL for Tablespace ###}
{% if data.spcname and not data.is_partitioned %}
{% if data.spcname %}
TABLESPACE {{ conn|qtIdent(data.spcname) }};
{% endif %}
{### Alter SQL for Owner ###}

View File

@ -1,5 +1,5 @@
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
(CASE WHEN length(spc.spcname) > 0 OR rel.relkind = 'p' 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)

View File

@ -170,6 +170,10 @@ class TableAddTestCase(BaseTestGenerator):
self.table_name = "test_table_add_%s" % (str(uuid.uuid4())[1:8])
# Get the common data
data = tables_utils.get_table_common_data()
if self.server_information and \
'server_version' in self.server_information and \
self.server_information['server_version'] >= 120000:
data['spcname'] = None
data.update({
"name": self.table_name,
"relowner": db_user,