allow_jit = metacxt != tablecxt;
 
    /* build comparator for all columns */
-   /* XXX: should we support non-minimal tuples for the inputslot? */
    hashtable->tab_eq_func = ExecBuildGroupingEqual(inputDesc, inputDesc,
-                                                   &TTSOpsMinimalTuple, &TTSOpsMinimalTuple,
+                                                   NULL, &TTSOpsMinimalTuple,
                                                    numCols,
                                                    keyColIdx, eqfuncoids, collations,
                                                    allow_jit ? parent : NULL);
 
  16 | {3,7,11,16} | (16,"{3,7,11,16}")
 (16 rows)
 
+CREATE TEMP TABLE duplicates (a INT NOT NULL);
+INSERT INTO duplicates VALUES(1), (1);
+-- Try out a recursive UNION case where the non-recursive part's table slot
+-- uses TTSOpsBufferHeapTuple and contains duplicate rows.
+WITH RECURSIVE cte (a) as (
+   SELECT a FROM duplicates
+   UNION
+   SELECT a FROM cte
+)
+SELECT a FROM cte;
+ a 
+---
+ 1
+(1 row)
+
 -- SEARCH clause
 create temp table graph0( f int, t int, label text );
 insert into graph0 values
 
 SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON
 (t1.id=t2.id);
 
+CREATE TEMP TABLE duplicates (a INT NOT NULL);
+INSERT INTO duplicates VALUES(1), (1);
+
+-- Try out a recursive UNION case where the non-recursive part's table slot
+-- uses TTSOpsBufferHeapTuple and contains duplicate rows.
+WITH RECURSIVE cte (a) as (
+   SELECT a FROM duplicates
+   UNION
+   SELECT a FROM cte
+)
+SELECT a FROM cte;
+
 -- SEARCH clause
 
 create temp table graph0( f int, t int, label text );