1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Resolve partition strategy during early parsing

This has little practical value, but there's no reason to let the
partition strategy names travel through DDL as strings.

Reviewed-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/20221021093216.ffupd7epy2mytkux@alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2022-11-03 16:25:54 +01:00
parent cf8b7d374a
commit 5fca91025e
7 changed files with 54 additions and 56 deletions

View File

@@ -270,10 +270,6 @@ get_qual_from_partbound(Relation parent, PartitionBoundSpec *spec)
Assert(spec->strategy == PARTITION_STRATEGY_RANGE);
my_qual = get_qual_for_range(parent, spec, false);
break;
default:
elog(ERROR, "unexpected partition strategy: %d",
(int) key->strategy);
}
return my_qual;
@@ -338,11 +334,6 @@ partition_bounds_create(PartitionBoundSpec **boundspecs, int nparts,
case PARTITION_STRATEGY_RANGE:
return create_range_bounds(boundspecs, nparts, key, mapping);
default:
elog(ERROR, "unexpected partition strategy: %d",
(int) key->strategy);
break;
}
Assert(false);
@@ -1181,12 +1172,9 @@ partition_bounds_merge(int partnatts,
jointype,
outer_parts,
inner_parts);
default:
elog(ERROR, "unexpected partition strategy: %d",
(int) outer_rel->boundinfo->strategy);
return NULL; /* keep compiler quiet */
}
return NULL;
}
/*
@@ -2892,8 +2880,7 @@ partitions_are_ordered(PartitionBoundInfo boundinfo, Bitmapset *live_parts)
return true;
break;
default:
/* HASH, or some other strategy */
case PARTITION_STRATEGY_HASH:
break;
}
@@ -3241,10 +3228,6 @@ check_new_partition_bound(char *relname, Relation parent,
break;
}
default:
elog(ERROR, "unexpected partition strategy: %d",
(int) key->strategy);
}
if (overlap)
@@ -3980,8 +3963,8 @@ make_partition_op_expr(PartitionKey key, int keynum,
key->partcollation[keynum]);
break;
default:
elog(ERROR, "invalid partitioning strategy");
case PARTITION_STRATEGY_HASH:
Assert(false);
break;
}