Don't quote bigints when copying them from the Query Tool results grid. Fixes #4459

This commit is contained in:
Aditya Toshniwal 2019-10-25 11:53:39 +01:00 committed by Dave Page
parent 4125360dfb
commit 6d7ff9444a
6 changed files with 251 additions and 344 deletions

View File

@ -20,5 +20,6 @@ Bug fixes
| `Issue #3789 <https://redmine.postgresql.org/issues/3789>`_ - Ensure context menus never get hidden below the menu bar. | `Issue #3789 <https://redmine.postgresql.org/issues/3789>`_ - Ensure context menus never get hidden below the menu bar.
| `Issue #3913 <https://redmine.postgresql.org/issues/3913>`_ - Ensure the correct "running at" agent is shown when a pgAgent job is executing. | `Issue #3913 <https://redmine.postgresql.org/issues/3913>`_ - Ensure the correct "running at" agent is shown when a pgAgent job is executing.
| `Issue #4459 <https://redmine.postgresql.org/issues/4459>`_ - Don't quote bigints when copying them from the Query Tool results grid.
| `Issue #4845 <https://redmine.postgresql.org/issues/4845>`_ - Fixed potential error in the properties dialog for the Code tab. | `Issue #4845 <https://redmine.postgresql.org/issues/4845>`_ - Fixed potential error in the properties dialog for the Code tab.
| `Issue #4850 <https://redmine.postgresql.org/issues/4850>`_ - Fixed an issue where Datetimepicker control opens when clicking on the label. | `Issue #4850 <https://redmine.postgresql.org/issues/4850>`_ - Fixed an issue where Datetimepicker control opens when clicking on the label.

View File

@ -7,8 +7,8 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
define(['sources/selection/range_selection_helper'], define(['sources/selection/range_selection_helper', 'json-bignumber'],
function (RangeSelectionHelper) { function (RangeSelectionHelper, JSONBigNumber) {
return { return {
getUnion: function (allRanges) { getUnion: function (allRanges) {
if (_.isEmpty(allRanges)) { if (_.isEmpty(allRanges)) {
@ -135,12 +135,13 @@ define(['sources/selection/range_selection_helper'],
csvCell: function (data, columnDefinitions, CSVOptions, rowId, colId) { csvCell: function (data, columnDefinitions, CSVOptions, rowId, colId) {
var val = data[rowId][columnDefinitions[colId].field], var val = data[rowId][columnDefinitions[colId].field],
cell_type = columnDefinitions[colId].cell || '',
quoting = CSVOptions.quoting || 'strings', quoting = CSVOptions.quoting || 'strings',
quote_char = CSVOptions.quote_char || '"'; quote_char = CSVOptions.quote_char || '"';
if (quoting == 'all') { if (quoting == 'all') {
if (val && _.isObject(val)) { if (val && _.isObject(val)) {
val = quote_char + JSON.stringify(val) + quote_char; val = quote_char + JSONBigNumber.stringify(val) + quote_char;
} else if (val) { } else if (val) {
val = quote_char + val.toString() + quote_char; val = quote_char + val.toString() + quote_char;
} else if (_.isNull(val) || _.isUndefined(val)) { } else if (_.isNull(val) || _.isUndefined(val)) {
@ -149,8 +150,8 @@ define(['sources/selection/range_selection_helper'],
} }
else if(quoting == 'strings') { else if(quoting == 'strings') {
if (val && _.isObject(val)) { if (val && _.isObject(val)) {
val = quote_char + JSON.stringify(val) + quote_char; val = quote_char + JSONBigNumber.stringify(val) + quote_char;
} else if (val && typeof val != 'number' && typeof val != 'boolean') { } else if (val && cell_type != 'number' && cell_type != 'boolean') {
val = quote_char + val.toString() + quote_char; val = quote_char + val.toString() + quote_char;
} else if (_.isNull(val) || _.isUndefined(val)) { } else if (_.isNull(val) || _.isUndefined(val)) {
val = ''; val = '';

View File

@ -411,6 +411,7 @@ import gettext from 'sources/gettext';
$input.addClass('pg-text-invalid'); $input.addClass('pg-text-invalid');
return { return {
valid: false, valid: false,
msg: e.message,
}; };
} }
} }

View File

@ -768,6 +768,7 @@ define('tools.querytool', [
display_name: c.display_name, display_name: c.display_name,
column_type: c.column_type, column_type: c.column_type,
column_type_internal: c.column_type_internal, column_type_internal: c.column_type_internal,
cell: c.cell,
not_null: c.not_null, not_null: c.not_null,
has_default_val: c.has_default_val, has_default_val: c.has_default_val,
is_array: c.is_array, is_array: c.is_array,

View File

@ -139,9 +139,9 @@ describe('RangeBoundaryNavigator', function () {
{'id':3, 'animal':'cougar', 'size':'9'}, {'id':3, 'animal':'cougar', 'size':'9'},
{'id':4, 'animal':'tiger', 'size':'10'}]; {'id':4, 'animal':'tiger', 'size':'10'}];
columnDefinitions = [{name: 'id', field: 'id', pos: 0}, columnDefinitions = [{name: 'id', field: 'id', pos: 0, cell:'number'},
{name: 'animal', field: 'animal', pos: 1}, {name: 'animal', field: 'animal', pos: 1, cell:'string'},
{name: 'size', field: 'size', pos: 2}]; {name: 'size', field: 'size', pos: 2, cell:'string'}];
ranges = [new Slick.Range(0, 0, 0, 2), new Slick.Range(3, 0, 3, 2)]; ranges = [new Slick.Range(0, 0, 0, 2), new Slick.Range(3, 0, 3, 2)];
CSVOptions = [{'quoting': 'all', 'quote_char': '"', 'field_separator': ','}, CSVOptions = [{'quoting': 'all', 'quote_char': '"', 'field_separator': ','},
@ -166,9 +166,9 @@ describe('RangeBoundaryNavigator', function () {
describe('when there is an extra column with checkboxes', function () { describe('when there is an extra column with checkboxes', function () {
beforeEach(function () { beforeEach(function () {
columnDefinitions = [{name: 'not-a-data-column'}, columnDefinitions = [{name: 'not-a-data-column'},
{name: 'id', field: 'id', pos: 0}, {name: 'id', field: 'id', pos: 0, cell:'number'},
{name: 'animal', field: 'animal', pos: 1}, {name: 'animal', field: 'animal', pos: 1, cell:'string'},
{name: 'size', field: 'size',pos: 2}]; {name: 'size', field: 'size',pos: 2, cell:'string'}];
ranges = [new Slick.Range(0, 0, 0, 3), new Slick.Range(3, 0, 3, 3)]; ranges = [new Slick.Range(0, 0, 0, 3), new Slick.Range(3, 0, 3, 3)];
}); });

File diff suppressed because it is too large Load Diff