Handle HASHPROC changes

PostgreSQL 11 now has "standard" and "extended" (64-bit) versions of
hash functions.
pull/1633/head
Jason Petersen 2017-09-01 12:03:15 -06:00
parent b4474fc0b0
commit bbc15e0598
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
3 changed files with 13 additions and 2 deletions

View File

@ -636,7 +636,8 @@ EnsureRelationCanBeDistributed(Oid relationId, Var *distributionColumn,
if (distributionMethod == DISTRIBUTE_BY_HASH) if (distributionMethod == DISTRIBUTE_BY_HASH)
{ {
Oid hashSupportFunction = SupportFunctionForColumn(distributionColumn, Oid hashSupportFunction = SupportFunctionForColumn(distributionColumn,
HASH_AM_OID, HASHPROC); HASH_AM_OID,
HASHSTANDARD_PROC);
if (hashSupportFunction == InvalidOid) if (hashSupportFunction == InvalidOid)
{ {
ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION),

View File

@ -35,6 +35,7 @@
#include "distributed/resource_lock.h" #include "distributed/resource_lock.h"
#include "distributed/transmit.h" #include "distributed/transmit.h"
#include "distributed/worker_protocol.h" #include "distributed/worker_protocol.h"
#include "distributed/version_compat.h"
#include "executor/spi.h" #include "executor/spi.h"
#include "mb/pg_wchar.h" #include "mb/pg_wchar.h"
#include "storage/lmgr.h" #include "storage/lmgr.h"
@ -191,7 +192,7 @@ worker_hash_partition_table(PG_FUNCTION_ARGS)
CheckCitusVersion(ERROR); CheckCitusVersion(ERROR);
/* use column's type information to get the hashing function */ /* use column's type information to get the hashing function */
hashFunction = GetFunctionInfo(partitionColumnType, HASH_AM_OID, HASHPROC); hashFunction = GetFunctionInfo(partitionColumnType, HASH_AM_OID, HASHSTANDARD_PROC);
/* create hash partition context object */ /* create hash partition context object */
partitionContext = palloc0(sizeof(HashPartitionContext)); partitionContext = palloc0(sizeof(HashPartitionContext));

View File

@ -21,4 +21,13 @@
#endif #endif
#if (PG_VERSION_NUM >= 90600 && PG_VERSION_NUM < 110000)
#include "access/hash.h"
/* PostgreSQL 11 splits hash procs into "standard" and "extended" */
#define HASHSTANDARD_PROC HASHPROC
#endif
#endif /* VERSION_COMPAT_H */ #endif /* VERSION_COMPAT_H */