Fixed an issue where the query tool displayed 'default' instead of 'null' for null text data in the data output. #9098

pull/9198/head
Aditya Toshniwal 2025-09-29 12:37:25 +05:30
parent 42ff67c845
commit 93bbadb994
3 changed files with 11 additions and 8 deletions

View File

@ -30,6 +30,7 @@ Housekeeping
Bug fixes
*********
| `Issue #9098 <https://github.com/pgadmin-org/pgadmin4/issues/9098>`_ - Fixed an issue where the query tool displayed 'default' instead of 'null' for null text data in the data output.
| `Issue #9158 <https://github.com/pgadmin-org/pgadmin4/issues/9158>`_ - Fixed an issue where saving the newly changed preferences was not reflecting on the preferences tab.
| `Issue #9125 <https://github.com/pgadmin-org/pgadmin4/issues/9125>`_ - Fixed an issue where the pgAdmin configuration database wasn't being created on a fresh install when an external database was used for the configuration.
| `Issue #9157 <https://github.com/pgadmin-org/pgadmin4/issues/9157>`_ - Fixed an issue where shortcuts are not working as expected on multiple keyboard layouts.

View File

@ -428,7 +428,7 @@ export class ResultSetUtils {
async (formData) => {
try {
await connectServer(
this.api,
this.api,
this.queryToolCtx.modal,
this.queryToolCtx.params.sid,
this.queryToolCtx.params.user,
@ -669,8 +669,9 @@ export class ResultSetUtils {
return columnVal;
}
processRows(result, columns, fromClipboard=false, pasteSerials=false) {
processRows(result, columns, options={}) {
let retVal = [];
let {fromClipboard=false, pasteSerials=false, isNewRow=false} = options;
if(!_.isArray(result) || !_.size(result)) {
return retVal;
}
@ -685,8 +686,9 @@ export class ResultSetUtils {
// Convert 2darray to dict.
let rowObj = {};
for(const col of columns) {
// if column data is undefined and there is not default value then set it to null.
let columnVal = rec[col.pos] ?? (col.has_default_val ? undefined : null);
// if column data is not present for existing rows then use null
// for new rows, it should be undefined if there is default value.
let columnVal = rec[col.pos] ?? ((col.has_default_val && isNewRow) ? undefined : null);
/* If the source is clipboard, then it needs some extra handling */
if(fromClipboard) {
columnVal = this.processClipboardVal(columnVal, col, copiedRowsObjects[recIdx]?.[col.key], pasteSerials);
@ -1379,7 +1381,7 @@ export function ResultSet() {
}, [selectedRows, queryData, dataChangeStore, rows, allRowsSelect]);
useEffect(()=>{
const triggerAddRows = (_rows, fromClipboard, pasteSerials)=>{
const triggerAddRows = (_rows, options)=>{
let insPosn = 0;
if(selectedRows.size > 0) {
let selectedRowsSorted = Array.from(selectedRows);
@ -1396,7 +1398,7 @@ export function ResultSet() {
return x;
});
}
let newRows = rsu.current.processRows(_rows, columns, fromClipboard, pasteSerials);
let newRows = rsu.current.processRows(_rows, columns, options);
setRows((prev)=>[
...prev.slice(0, insPosn),
...newRows,

View File

@ -281,13 +281,13 @@ export function ResultSetToolbar({query, canEdit, totalRowCount, pagination, all
field_separator: queryToolPref.results_grid_field_separator,
});
let copiedRows = copyUtils.getCopiedRows();
eventBus.fireEvent(QUERY_TOOL_EVENTS.TRIGGER_ADD_ROWS, copiedRows, true, checkedMenuItems['paste_with_serials']);
eventBus.fireEvent(QUERY_TOOL_EVENTS.TRIGGER_ADD_ROWS, copiedRows, {fromClipboard: true, pasteSerials: checkedMenuItems['paste_with_serials']});
}, [queryToolPref, checkedMenuItems['paste_with_serials']]);
const copyData = ()=>{
eventBus.fireEvent(QUERY_TOOL_EVENTS.COPY_DATA, checkedMenuItems['copy_with_headers']);
};
const addRow = useCallback(()=>{
eventBus.fireEvent(QUERY_TOOL_EVENTS.TRIGGER_ADD_ROWS, [[]]);
eventBus.fireEvent(QUERY_TOOL_EVENTS.TRIGGER_ADD_ROWS, [[]], {isNewRow: true});
}, []);
const downloadResult = useCallback(()=>{
eventBus.fireEvent(QUERY_TOOL_EVENTS.TRIGGER_SAVE_RESULTS);