diff --git a/pgadmin/frm/frmEditGrid.cpp b/pgadmin/frm/frmEditGrid.cpp
index 8145c10..908da3f 100644
--- a/pgadmin/frm/frmEditGrid.cpp
+++ b/pgadmin/frm/frmEditGrid.cpp
@@ -2570,8 +2573,10 @@ bool sqlTable::StoreLine()
                     + wxT("(") + colList 
                     + wxT(") VALUES (") + valList
                     + wxT(")"));
-                if (set)
+				if (set)
                 {
+					if (set->GetInsertedCount() > 0)
+					{
                     if (hasOids)
                         line->cols[0] = NumToStr((long)set->GetInsertedOid());
                     delete set;
@@ -2608,6 +2613,7 @@ bool sqlTable::StoreLine()
                             delete set;
                         }
                     }
+                    }
                 }
             }
         }
