From 6c7116a20c932c8d383cc7aaa551f86d81c5aa37 Mon Sep 17 00:00:00 2001 From: Pravesh Sharma Date: Mon, 3 Apr 2023 10:57:45 +0530 Subject: [PATCH] Fix an issue where insert was failing when copy pasting a row and saving in result grid. #5934 --- .../sqleditor/static/js/components/sections/ResultSet.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx index b2c53fcbd..0c7f5d347 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx @@ -1292,6 +1292,11 @@ export function ResultSet() { const onRowsChange = (newRows, otherInfo)=>{ let row = newRows[otherInfo.indexes[0]]; let clientPK = rowKeyGetter(row); + + // Check if column is pk and value is null set it to default value. + if(otherInfo.column.has_default_val && _.isNull(row[otherInfo.column.key]) && otherInfo.column.key in queryData.primary_keys) { + row[otherInfo.column.key] = undefined; + } if(clientPK in (dataChangeStore.added || {})) { /* No need to track this */