Skip to content

Commit 9b682a5

Browse files
authored
Fix v15 build (#90)
* Fix creation of the "custom_objects_cache" hash table The hash table was declared as hashing strings, but is used for OIDs. This bug was brought to light by PostgreSQL commit b3817f5f77, which made it compulsory to specify the kind of objects that was hashed. * Remove reference to the "Value" node PostgreSQL commit 639a86e36a removed "Value", so use "Node" instead. * Adapt to PostgreSQL commit a49d081235 That commit got rid of FirstBootstrapObjectId and introduced FirstUnpinnedObjectId instead.
1 parent ff6cc49 commit 9b682a5

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/custom_types.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ create_custom_objects_cache(void)
4343
ctl.keysize = sizeof(Oid);
4444
ctl.entrysize = sizeof(CustomObjectDef);
4545

46-
return hash_create("clickhouse_fdw custom functions", 20, &ctl, HASH_ELEM);
46+
return hash_create("clickhouse_fdw custom functions", 20, &ctl, HASH_ELEM | HASH_BLOBS);
4747
}
4848

4949
static void

src/include/clickhousedb_fdw.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#include "nodes/pathnodes.h"
2626
#endif
2727

28+
#if PG_VERSION_NUM < 150000
29+
#define FirstUnpinnedObjectId FirstBootstrapObjectId
30+
#endif
31+
2832
/* libclickhouse_link.c */
2933
typedef struct ch_cursor ch_cursor;
3034
typedef struct ch_cursor

src/pglink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ chfdw_construct_create_tables(ImportForeignSchemaStmt *stmt, ForeignServer *serv
940940
appendStringInfoString(&buf, " OPTIONS (");
941941
foreach(lc, options)
942942
{
943-
Value *val = lfirst(lc);
943+
Node *val = lfirst(lc);
944944
if (IsA(val, Integer))
945945
{
946946
if (!first)

src/shipable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ lookup_shippable(Oid objectId, Oid classId, CHFdwRelationInfo *fpinfo)
134134
/*
135135
* Return true if given object is one of PostgreSQL's built-in objects.
136136
*
137-
* We use FirstBootstrapObjectId as the cutoff, so that we only consider
137+
* We use FirstUnpinnedObjectId as the cutoff, so that we only consider
138138
* objects with hand-assigned OIDs to be "built in", not for instance any
139139
* function or type defined in the information_schema.
140140
*
@@ -151,7 +151,7 @@ lookup_shippable(Oid objectId, Oid classId, CHFdwRelationInfo *fpinfo)
151151
bool
152152
chfdw_is_builtin(Oid objectId)
153153
{
154-
return (objectId < FirstBootstrapObjectId);
154+
return (objectId < FirstUnpinnedObjectId);
155155
}
156156

157157
/*

0 commit comments

Comments
 (0)