Fixed an issue where changing the values of columns with JSONB or JSON types to NULL. Fixes #4969

This commit is contained in:
Aditya Toshniwal 2020-04-13 12:34:32 +05:30 committed by Akshay Joshi
parent 077589e08b
commit b427a87724
2 changed files with 7 additions and 4 deletions

View File

@ -11,7 +11,7 @@ New features
| `Issue #2172 <https://redmine.postgresql.org/issues/2172>`_ - Added search object functionality.
| `Issue #2186 <https://redmine.postgresql.org/issues/2186>`_ - Added LDAP authentication support.
| `Issue #5184 <https://redmine.postgresql.org/issues/5184>`_ - Added support for parameter toast_tuple_target and parallel_workers of the table.
| `Issue #5181 <https://redmine.postgresql.org/issues/5181>`_ - Added support for parameter toast_tuple_target and parallel_workers of the table.
| `Issue #5263 <https://redmine.postgresql.org/issues/5263>`_ - Added support of Foreign Tables to the Schema Diff.
| `Issue #5264 <https://redmine.postgresql.org/issues/5264>`_ - Added support of Packages, Sequences and Synonyms to the Schema Diff.
| `Issue #5353 <https://redmine.postgresql.org/issues/5353>`_ - Added an option to prevent a browser tab being opened at startup.
@ -31,6 +31,7 @@ Bug fixes
| `Issue #4206 <https://redmine.postgresql.org/issues/4206>`_ - Ensure that the grant wizard should be closed on pressing the ESC key.
| `Issue #4512 <https://redmine.postgresql.org/issues/4512>`_ - Fixed calendar opening issue on the exception tab inside the schedules tab of pgAgent.
| `Issue #4856 <https://redmine.postgresql.org/issues/4856>`_ - Enable the save button by default when a query tool is opened with CREATE or other scripts.
| `Issue #4969 <https://redmine.postgresql.org/issues/4969>`_ - Fixed an issue where changing the values of columns with JSONB or JSON types to NULL.
| `Issue #5053 <https://redmine.postgresql.org/issues/5053>`_ - Fixed an issue where changing the columns in the existing view throws an error.
| `Issue #5180 <https://redmine.postgresql.org/issues/5180>`_ - Fixed an issue where the autovacuum_enabled parameter is added automatically in the RE-SQL when the table has been created using the WITH clause.
| `Issue #5227 <https://redmine.postgresql.org/issues/5227>`_ - Fixed an issue where user cannot be added if many users are already exists.

View File

@ -110,7 +110,7 @@ import gettext from 'sources/gettext';
grid.copied_rows[row][cell] = 1;
}
} else {
if(column_type === 'jsonb') {
if(column_type === 'jsonb' && state != null) {
item[args.column.field] = JSONBigNumber.stringify(JSONBigNumber.parse(state));
} else {
item[args.column.field] = state;
@ -361,7 +361,7 @@ import gettext from 'sources/gettext';
this.loadValue = function(item) {
var data = defaultValue = item[args.column.field];
/* If jsonb or array */
if(args.column.column_type_internal === 'jsonb' && !Array.isArray(data)) {
if(args.column.column_type_internal === 'jsonb' && !Array.isArray(data) && data != null) {
data = JSONBigNumber.stringify(JSONBigNumber.parse(data), null, 4);
} else if (Array.isArray(data)) {
var temp = [];
@ -406,7 +406,9 @@ import gettext from 'sources/gettext';
if(args.column.column_type_internal === 'jsonb' ||
args.column.column_type_internal === 'json') {
try {
JSON.parse($input.val());
if($input.val() != ''){
JSON.parse($input.val());
}
} catch(e) {
$input.addClass('pg-text-invalid');
return {