Skip to content

Commit

Permalink
global function renaming due to conflicts with postgres_fdw
Browse files Browse the repository at this point in the history
  • Loading branch information
ildus committed Aug 9, 2019
1 parent 52873da commit f4866f9
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 241 deletions.
16 changes: 8 additions & 8 deletions src/clickhousedb_adjust.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ create_custom_columns_cache(void)
return hash_create("clickhouse_fdw custom functions", 20, &ctl, HASH_ELEM | HASH_BLOBS);
}

CustomObjectDef *checkForCustomFunction(Oid funcid)
CustomObjectDef *chfdw_check_for_custom_function(Oid funcid)
{
CustomObjectDef *entry;

if (is_builtin(funcid))
if (chfdw_is_builtin(funcid))
{
switch (funcid)
{
Expand Down Expand Up @@ -131,15 +131,15 @@ CustomObjectDef *checkForCustomFunction(Oid funcid)
return entry;
}

CustomObjectDef *checkForCustomType(Oid typeoid)
CustomObjectDef *chfdw_check_for_custom_type(Oid typeoid)
{
const char *proname;

CustomObjectDef *entry;
if (!custom_objects_cache)
custom_objects_cache = create_custom_objects_cache();

if (is_builtin(typeoid))
if (chfdw_is_builtin(typeoid))
return NULL;

entry = hash_search(custom_objects_cache, (void *) &typeoid, HASH_FIND, NULL);
Expand All @@ -166,7 +166,7 @@ CustomObjectDef *checkForCustomType(Oid typeoid)
return entry;
}

CustomObjectDef *checkForCustomOperator(Oid opoid, Form_pg_operator form)
CustomObjectDef *chfdw_check_for_custom_operator(Oid opoid, Form_pg_operator form)
{
HeapTuple tuple = NULL;
const char *proname;
Expand All @@ -175,7 +175,7 @@ CustomObjectDef *checkForCustomOperator(Oid opoid, Form_pg_operator form)
if (!custom_objects_cache)
custom_objects_cache = create_custom_objects_cache();

if (is_builtin(opoid))
if (chfdw_is_builtin(opoid))
{
switch (opoid) {
/* timestamptz + interval */
Expand Down Expand Up @@ -229,7 +229,7 @@ CustomObjectDef *checkForCustomOperator(Oid opoid, Form_pg_operator form)
* New options might also require tweaking merge_fdw_options().
*/
void
ApplyCustomTableOptions(CHFdwRelationInfo *fpinfo, Oid relid)
chfdw_apply_custom_table_options(CHFdwRelationInfo *fpinfo, Oid relid)
{
ListCell *lc;
TupleDesc tupdesc;
Expand Down Expand Up @@ -312,7 +312,7 @@ ApplyCustomTableOptions(CHFdwRelationInfo *fpinfo, Oid relid)

/* Get foreign relation options */
CustomColumnInfo *
GetCustomColumnInfo(Oid relid, uint16 varattno)
chfdw_get_custom_column_info(Oid relid, uint16 varattno)
{
CustomColumnInfo entry_key,
*entry;
Expand Down
10 changes: 5 additions & 5 deletions src/clickhousedb_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ clickhouse_connect(ForeignServer *server, UserMapping *user)
/* default settings */
ch_connection_details details = {"127.0.0.1", 8123, NULL, NULL, "default"};

ExtractConnectionOptions(server->options, &driver, &details.host,
chfdw_extract_options(server->options, &driver, &details.host,
&details.port, &details.dbname, &details.username, &details.password);
ExtractConnectionOptions(user->options, &driver, &details.host,
chfdw_extract_options(user->options, &driver, &details.host,
&details.port, &details.dbname, &details.username, &details.password);

if (strcmp(driver, "http") == 0)
Expand All @@ -64,7 +64,7 @@ clickhouse_connect(ForeignServer *server, UserMapping *user)
else
connstring = psprintf("http://%s:%d/", details.host, details.port);

conn = http_connect(connstring);
conn = chfdw_http_connect(connstring);
pfree(connstring);
return conn;
}
Expand All @@ -73,14 +73,14 @@ clickhouse_connect(ForeignServer *server, UserMapping *user)
if (details.port == 8123)
details.port = 9000;

return binary_connect(&details);
return chfdw_binary_connect(&details);
}
else
elog(ERROR, "invalid ClickHouse connection driver");
}

ch_connection
GetConnection(UserMapping *user)
chfdw_get_connection(UserMapping *user)
{
bool found;
ConnCacheEntry *entry;
Expand Down
Loading

0 comments on commit f4866f9

Please sign in to comment.