MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / EvalShardBucketCount

Function EvalShardBucketCount

pkg/sql/sem/tree/create.go:838–852  ·  view source on GitHub ↗

EvalShardBucketCount evaluates and checks the integer argument to a `USING HASH WITH BUCKET_COUNT` index creation query.

(shardBuckets Expr)

Source from the content-addressed store, hash-verified

836// EvalShardBucketCount evaluates and checks the integer argument to a `USING HASH WITH
837// BUCKET_COUNT` index creation query.
838func EvalShardBucketCount(shardBuckets Expr) (int32, error) {
839 const invalidBucketCountMsg = `BUCKET_COUNT must be a strictly positive integer value`
840 cst, ok := shardBuckets.(*NumVal)
841 if !ok {
842 return 0, pgerror.New(pgcode.InvalidParameterValue, invalidBucketCountMsg)
843 }
844 buckets, err := cst.AsInt32()
845 if err != nil || buckets <= 0 {
846 if err != nil {
847 return 0, pgerror.Wrap(err, pgcode.InvalidParameterValue, invalidBucketCountMsg)
848 }
849 return 0, pgerror.New(pgcode.InvalidParameterValue, invalidBucketCountMsg)
850 }
851 return buckets, nil
852}
853
854// Format implements the NodeFormatter interface.
855func (node *ShardedIndexDef) Format(ctx *FmtCtx) {

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
WrapFunction · 0.92
AsInt32Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…