Skip to content

Commit 42d0186

Browse files
committed
Lookup the Oid for int8eq using the parser
kudos @edongashi for the parser suggestion
1 parent c3b835d commit 42d0186

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

pg_diffix/oid_cache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ typedef struct Oids
5656

5757
/* Internal functions */
5858
Oid internal_qual_wrapper; /* diffix.internal_qual_wrapper(boolean) */
59+
60+
Oid op_int8eq;
5961
} Oids;
6062

6163
/*

src/oid_cache.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "catalog/pg_type.h"
44
#include "lib/stringinfo.h"
55
#include "parser/parse_func.h"
6+
#include "parser/parse_oper.h"
67
#include "utils/lsyscache.h"
78

89
#include "pg_diffix/oid_cache.h"
@@ -66,6 +67,10 @@ void oid_cache_init(void)
6667

6768
g_oid_cache.internal_qual_wrapper = lookup_function("diffix", "internal_qual_wrapper", 1, (Oid[]){BOOLOID});
6869

70+
List *eq_op_name = list_make1(makeString("="));
71+
g_oid_cache.op_int8eq = LookupOperName(NULL, eq_op_name, INT8OID, INT8OID, false, -1);
72+
list_free_deep(eq_op_name);
73+
6974
g_loaded = true;
7075
}
7176

src/query/anonymization.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static Expr *make_safe_anon_count_value(const Aggref *source_aggref)
202202
count_aggref->aggdistinct = false;
203203

204204
NullIfExpr *nullif = makeNode(NullIfExpr);
205-
nullif->opno = 410; /* = for int8eq. */
205+
nullif->opno = g_oid_cache.op_int8eq;
206206
nullif->opfuncid = F_INT8EQ;
207207
nullif->opresulttype = count_aggref->aggtype;
208208
nullif->opretset = false;

0 commit comments

Comments
 (0)