Index: pgadmin/frm/frmEditGrid.cpp
===================================================================
--- pgadmin/frm/frmEditGrid.cpp	(revision 7060)
+++ pgadmin/frm/frmEditGrid.cpp	(working copy)
@@ -477,29 +477,30 @@
 	
 	size_t old_filter_string_length = GetFilter().Trim().Len();
 	
-	if (old_filter_string_length > 0) {
+	if (old_filter_string_length > 0) 
 		new_filter_string = GetFilter().Trim() + wxT(" \n    AND ");
-	}
-		
-	if (table->IsColText(curcol)) {
 
-		if (sqlGrid->GetCellValue(currow, curcol).IsNull()) {
+	if (table->IsColText(curcol)) 
+	{
+
+		if (sqlGrid->GetCellValue(currow, curcol).IsNull()) 
+		{	
 			new_filter_string += column_label + wxT(" IS NULL ");
-		} else {
-			
-			if (sqlGrid->GetCellValue(currow, curcol) == wxT("\'\'")) {
+		}
+		else 
+		{
+			if (sqlGrid->GetCellValue(currow, curcol) == wxT("\'\'")) 
 				new_filter_string += column_label + wxT(" = ''");
-			} else {
+			else
 				new_filter_string += column_label + wxT(" = ") + connection->qtDbString(sqlGrid->GetCellValue(currow, curcol)) + wxT(" ");
-			}
 		}
-	} else {
-		
-		if (sqlGrid->GetCellValue(currow, curcol).IsNull()) {
+	} 
+	else 
+	{
+		if (sqlGrid->GetCellValue(currow, curcol).IsNull()) 
 			new_filter_string += column_label + wxT(" IS NULL ");
-		} else {
+		else
 			new_filter_string += column_label + wxT(" = ") + sqlGrid->GetCellValue(currow, curcol);
-		}
 	}
 	
 	SetFilter(new_filter_string);
@@ -519,28 +520,29 @@
 	
 	size_t old_filter_string_length = GetFilter().Trim().Len();
 	
-	if (old_filter_string_length > 0) {
+	if (old_filter_string_length > 0)
 		new_filter_string = GetFilter().Trim() + wxT(" \n    AND ");
-	}
 	
-	if (table->IsColText(curcol)) {
-		if (sqlGrid->GetCellValue(currow, curcol).IsNull()) {
+	if (table->IsColText(curcol)) 
+	{
+		if (sqlGrid->GetCellValue(currow, curcol).IsNull())
+		{
 			new_filter_string += column_label + wxT(" IS NOT NULL ");
-		} else {
-			
-			if (sqlGrid->GetCellValue(currow, curcol) == wxT("\'\'")) {
-				new_filter_string += column_label + wxString::Format(_(" <> '' ")) ;
-			} else {
-				new_filter_string += column_label + wxT(" <> ") + connection->qtDbString(sqlGrid->GetCellValue(currow, curcol)) + wxT(" ");
-			}
+		} 
+		else 
+		{	
+			if (sqlGrid->GetCellValue(currow, curcol) == wxT("\'\'")) 
+				new_filter_string += column_label + wxString::Format(_(" IS DISTINCT FROM '' ")) ;
+			else
+				new_filter_string += column_label + wxT(" IS DISTINCT FROM ") + connection->qtDbString(sqlGrid->GetCellValue(currow, curcol)) + wxT(" ");
 		}
-	} else {
-		
-		if (sqlGrid->GetCellValue(currow, curcol).IsNull()) {
+	}
+	else
+	{
+		if (sqlGrid->GetCellValue(currow, curcol).IsNull())
 			new_filter_string += column_label + wxT(" IS NOT NULL ") ;
-		} else {
-			new_filter_string += column_label + wxT(" <> ") + sqlGrid->GetCellValue(currow, curcol);
-		}
+		else
+			new_filter_string += column_label + wxT(" IS DISTINCT FROM ") + sqlGrid->GetCellValue(currow, curcol);
 	}
 
 	SetFilter(new_filter_string);
@@ -567,9 +569,8 @@
 	
 	size_t old_sort_string_length = GetSortCols().Trim().Len();
 	
-	if (old_sort_string_length > 0) {
+	if (old_sort_string_length > 0) 
 		new_sort_string = GetSortCols().Trim() + wxT(" , ");
-	}
 	
 	new_sort_string += column_label + wxT(" ASC ");
 	
@@ -589,9 +590,8 @@
 	
 	size_t old_sort_string_length = GetSortCols().Trim().Len();
 	
-	if (old_sort_string_length > 0) {
+	if (old_sort_string_length > 0)
 		new_sort_string = GetSortCols().Trim() + wxT(" , ");
-	}
 	
 	new_sort_string += column_label + wxT(" DESC ");
 	