1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-18 02:02:55 +03:00

Fix misuse of Relids for storing attribute numbers

The typedef Relids (Bitmapset *) is intended to represent set of
relation identifiers, but was incorrectly used in several places to
store sets of attribute numbers.  This is my oversight in e2debb643.

Fix that by replacing such usages with Bitmapset * to reflect the
correct semantics.

Author: Junwang Zhao <zhjwpku@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAEG8a3LJhp_xriXf39iCz0TsK+M-2biuhDhpLC6Baxw8+ZYT3A@mail.gmail.com
This commit is contained in:
Richard Guo
2025-09-12 11:12:19 +09:00
parent 528dadf691
commit 2d756ebbe8
3 changed files with 5 additions and 5 deletions

View File

@@ -4203,7 +4203,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
bool
var_is_nonnullable(PlannerInfo *root, Var *var, bool use_rel_info)
{
Relids notnullattnums = NULL;
Bitmapset *notnullattnums = NULL;
Assert(IsA(var, Var));

View File

@@ -62,7 +62,7 @@ get_relation_info_hook_type get_relation_info_hook = NULL;
typedef struct NotnullHashEntry
{
Oid relid; /* OID of the relation */
Relids notnullattnums; /* attnums of NOT NULL columns */
Bitmapset *notnullattnums; /* attnums of NOT NULL columns */
} NotnullHashEntry;
@@ -683,7 +683,7 @@ get_relation_notnullatts(PlannerInfo *root, Relation relation)
Oid relid = RelationGetRelid(relation);
NotnullHashEntry *hentry;
bool found;
Relids notnullattnums = NULL;
Bitmapset *notnullattnums = NULL;
/* bail out if the relation has no not-null constraints */
if (relation->rd_att->constr == NULL ||
@@ -750,7 +750,7 @@ get_relation_notnullatts(PlannerInfo *root, Relation relation)
* Searches the hash table and returns the column not-null constraint
* information for a given relation.
*/
Relids
Bitmapset *
find_relation_notnullatts(PlannerInfo *root, Oid relid)
{
NotnullHashEntry *hentry;

View File

@@ -30,7 +30,7 @@ extern void get_relation_info(PlannerInfo *root, Oid relationObjectId,
extern void get_relation_notnullatts(PlannerInfo *root, Relation relation);
extern Relids find_relation_notnullatts(PlannerInfo *root, Oid relid);
extern Bitmapset *find_relation_notnullatts(PlannerInfo *root, Oid relid);
extern List *infer_arbiter_indexes(PlannerInfo *root);