diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 3fffe09..9df13e2 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -27,6 +27,7 @@
 #include "libpq/pqformat.h"
 #include "miscadmin.h"
 #include "parser/scansup.h"
+#include "parser/parser.h"
 #include "regex/regex.h"
 #include "utils/builtins.h"
 #include "utils/bytea.h"
@@ -34,6 +35,8 @@
 #include "utils/pg_locale.h"
 #include "utils/sortsupport.h"
 
+#define DEBUG_ABBREV_KEYS
+
 #ifdef DEBUG_ABBREV_KEYS
 #define DEBUG_elog_output	DEBUG1
 #endif
@@ -93,9 +96,9 @@ static int bttextfastcmp_c(Datum x, Datum y, SortSupport ssup);
 static int bttextfastcmp_locale(Datum x, Datum y, SortSupport ssup);
 static Datum bttext_convert(Datum original, SortSupport ssup);
 static bool bttext_abort(int memtupcount, double rowhint, SortSupport ssup);
-#ifdef WIN32
+//#ifdef WIN32
 static void bttext_inject_shim(SortSupport ssup, Oid collid);
-#endif
+//#endif
 static int32 text_length(Datum str);
 static text *text_catenate(text *t1, text *t2);
 static text *text_substring(Datum str,
@@ -1746,8 +1749,9 @@ btsortsupport_worker(SortSupport ssup, Oid collid)
 	 * WIN32 requires complex hacks when the database encoding is UTF-8 (except
 	 * when using the "C" collation).  For now, we don't optimize that case.
 	 */
-#ifdef WIN32
-	if (GetDatabaseEncoding() == PG_UTF8 && !lc_collate_is_c(collid))
+//#ifdef WIN32
+//if (GetDatabaseEncoding() == PG_UTF8 && !lc_collate_is_c(collid))
+	if (backslash_quote == BACKSLASH_QUOTE_OFF)
 	{
 		/*
 		 * No need to worry about collation error handling, since varstr_cmp()
@@ -1756,7 +1760,7 @@ btsortsupport_worker(SortSupport ssup, Oid collid)
 		bttext_inject_shim(ssup, collid);
 		return;
 	}
-#endif
+//#endif
 
 	/*
 	 * On platforms where the abbreviated key for text optimization might have
@@ -2304,9 +2308,11 @@ bttext_abort(int memtupcount, double rowhint, SortSupport ssup)
 	elog(DEBUG_elog_output, "would have aborted abbreviation due to worst-case at %d. abbrev_distinct: %f, key_distinct: %f",
 		 memtupcount, abbrev_distinct, key_distinct);
 	/* Actually abort only when debugging is disabled */
-	return false;
+	if (backslash_quote == BACKSLASH_QUOTE_ON)
+		return false;
 #endif
 
+	//if (backslash_quote == BACKSLASH_QUOTE_SAFE_ENCODING)
 	return true;
 }
 
@@ -2319,7 +2325,7 @@ bttext_abort(int memtupcount, double rowhint, SortSupport ssup)
  * function pointer comparator.  Rather than revising that principle, just
  * setup a shim for the WIN32 UTF-8 and non-"C" collation special case here.
  */
-#ifdef WIN32
+//#ifdef WIN32
 static void
 bttext_inject_shim(SortSupport ssup, Oid collid)
 {
@@ -2341,7 +2347,7 @@ bttext_inject_shim(SortSupport ssup, Oid collid)
 	ssup->position = sortKeyTiebreak;
 	PrepareSortSupportComparisonShim(sortfunc, ssup);
 }
-#endif
+//#endif
 
 Datum
 text_larger(PG_FUNCTION_ARGS)
