mirror of https://github.com/citusdata/citus.git
Use pg_dist_object, remove pg_dist_enabled_custom_aggregates
parent
ec4f8b23e7
commit
79f4fdbc89
|
@ -34,7 +34,6 @@
|
|||
#include "distributed/multi_logical_planner.h"
|
||||
#include "distributed/multi_physical_planner.h"
|
||||
#include "distributed/pg_dist_partition.h"
|
||||
#include "distributed/pg_dist_enabled_custom_aggregates.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
|
@ -253,7 +252,7 @@ static List * WorkerAggregateExpressionList(Aggref *originalAggregate,
|
|||
WorkerAggregateWalkerContext *walkerContextry);
|
||||
static AggregateType GetAggregateType(Oid aggFunctionId);
|
||||
static Oid AggregateArgumentType(Aggref *aggregate);
|
||||
static bool AggregateEnabledCustom(const char *functionName);
|
||||
static bool AggregateEnabledCustom(Oid aggregateOid);
|
||||
static Oid AggregateFunctionOidWithoutInput(const char *functionName);
|
||||
static Oid AggregateFunctionOid(const char *functionName, Oid inputType);
|
||||
static Oid TypeOid(Oid schemaId, const char *typeName);
|
||||
|
@ -3014,7 +3013,7 @@ GetAggregateType(Oid aggFunctionId)
|
|||
aggFunctionId)));
|
||||
}
|
||||
|
||||
if (AggregateEnabledCustom(aggregateProcName))
|
||||
if (AggregateEnabledCustom(aggFunctionId))
|
||||
{
|
||||
return AGGREGATE_CUSTOM;
|
||||
}
|
||||
|
@ -3058,31 +3057,12 @@ AggregateArgumentType(Aggref *aggregate)
|
|||
|
||||
|
||||
static bool
|
||||
AggregateEnabledCustom(const char *functionName)
|
||||
AggregateEnabledCustom(Oid aggregateOid)
|
||||
{
|
||||
SysScanDesc scanDescriptor = NULL;
|
||||
ScanKeyData scanKey[1];
|
||||
bool enabled = false;
|
||||
HeapTuple heapTuple = NULL;
|
||||
Relation pgDistEnabledCustomAggregates = NULL;
|
||||
DistObjectCacheEntry *cacheEntry = LookupDistObjectCacheEntry(AggregateRelationId,
|
||||
aggregateOid, 0);
|
||||
|
||||
ScanKeyInit(&scanKey[0], Anum_pg_dist_enabled_custom_aggregates_name,
|
||||
BTEqualStrategyNumber, F_NAMEEQ, CStringGetDatum(functionName));
|
||||
|
||||
pgDistEnabledCustomAggregates = heap_open(DistEnabledCustomAggregatesId(),
|
||||
AccessShareLock);
|
||||
|
||||
scanDescriptor = systable_beginscan(pgDistEnabledCustomAggregates, InvalidOid, false,
|
||||
NULL, 1, scanKey);
|
||||
|
||||
heapTuple = systable_getnext(scanDescriptor);
|
||||
|
||||
enabled = HeapTupleIsValid(heapTuple);
|
||||
|
||||
systable_endscan(scanDescriptor);
|
||||
heap_close(pgDistEnabledCustomAggregates, AccessShareLock);
|
||||
|
||||
return enabled;
|
||||
return cacheEntry != NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,10 +62,4 @@ CREATE AGGREGATE coord_combine_agg(oid, bytea, anyelement) (
|
|||
PARALLEL = SAFE
|
||||
);
|
||||
|
||||
CREATE TABLE citus.pg_dist_enabled_custom_aggregates (
|
||||
name text not null primary key
|
||||
);
|
||||
ALTER TABLE citus.pg_dist_enabled_custom_aggregates SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.pg_dist_node_metadata TO public;
|
||||
|
||||
RESET search_path;
|
||||
|
|
|
@ -128,7 +128,6 @@ typedef struct MetadataCacheData
|
|||
Oid distPlacementShardidIndexId;
|
||||
Oid distPlacementPlacementidIndexId;
|
||||
Oid distPlacementGroupidIndexId;
|
||||
Oid distEnabledCustomAggregatesId;
|
||||
Oid distTransactionRelationId;
|
||||
Oid distTransactionGroupIndexId;
|
||||
Oid distTransactionRecordIndexId;
|
||||
|
@ -2114,17 +2113,6 @@ DistPlacementGroupidIndexId(void)
|
|||
}
|
||||
|
||||
|
||||
/* return oid of pg_dist_enabled_custom_aggregates relation */
|
||||
Oid
|
||||
DistEnabledCustomAggregatesId(void)
|
||||
{
|
||||
CachedRelationLookup("pg_dist_enabled_custom_aggregates",
|
||||
&MetadataCache.distEnabledCustomAggregatesId);
|
||||
|
||||
return MetadataCache.distEnabledCustomAggregatesId;
|
||||
}
|
||||
|
||||
|
||||
/* return oid of the read_intermediate_result(text,citus_copy_format) function */
|
||||
Oid
|
||||
CitusReadIntermediateResultFuncId(void)
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* pg_dist_enabled_custom_aggregates.h
|
||||
* definition of the relation that lists which aggregates to treat as custom aggregates.
|
||||
*
|
||||
* Copyright (c) 2012-2019, Citus Data, Inc.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PG_DIST_ENABLED_CUSTOM_AGGREGATES_H
|
||||
#define PG_DIST_ENABLED_CUSTOM_AGGREGATES_H
|
||||
|
||||
#define Natts_pg_dist_node 1
|
||||
#define Anum_pg_dist_enabled_custom_aggregates_name 1
|
||||
|
||||
#endif /* PG_DIST_ENABLED_CUSTOM_AGGREGATES_H */
|
|
@ -18,11 +18,10 @@ WHERE
|
|||
AND ext.extname = 'citus'
|
||||
AND nsp.nspname = 'pg_catalog'
|
||||
AND NOT has_table_privilege(pg_class.oid, 'select');
|
||||
oid
|
||||
-----------------------------------
|
||||
pg_dist_enabled_custom_aggregates
|
||||
oid
|
||||
------------------
|
||||
pg_dist_authinfo
|
||||
(2 rows)
|
||||
(1 row)
|
||||
|
||||
RESET role;
|
||||
DROP USER no_access;
|
||||
|
|
Loading…
Reference in New Issue