Skip to content

Commit f8c2803

Browse files
tglsfdcpull[bot]
authored andcommitted
Fix omissions in support for the "regcollation" type.
The patch that added regcollation doesn't seem to have been too thorough about supporting it everywhere that other reg* types are supported. Fix that. (The find_expr_references omission is moderately serious, since it could result in missing expression dependencies. The others are less exciting.) Noted while fixing bug #17483. Back-patch to v13 where regcollation was added. Discussion: https://postgr.es/m/1423433.1652722406@sss.pgh.pa.us
1 parent ceb79c9 commit f8c2803

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/backend/catalog/dependency.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,6 +1839,13 @@ find_expr_references_walker(Node *node,
18391839
add_object_address(OCLASS_TYPE, objoid, 0,
18401840
context->addrs);
18411841
break;
1842+
case REGCOLLATIONOID:
1843+
objoid = DatumGetObjectId(con->constvalue);
1844+
if (SearchSysCacheExists1(COLLOID,
1845+
ObjectIdGetDatum(objoid)))
1846+
add_object_address(OCLASS_COLLATION, objoid, 0,
1847+
context->addrs);
1848+
break;
18421849
case REGCONFIGOID:
18431850
objoid = DatumGetObjectId(con->constvalue);
18441851
if (SearchSysCacheExists1(TSCONFIGOID,

src/backend/utils/adt/selfuncs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4326,6 +4326,7 @@ convert_to_scalar(Datum value, Oid valuetypid, Oid collid, double *scaledvalue,
43264326
case REGOPERATOROID:
43274327
case REGCLASSOID:
43284328
case REGTYPEOID:
4329+
case REGCOLLATIONOID:
43294330
case REGCONFIGOID:
43304331
case REGDICTIONARYOID:
43314332
case REGROLEOID:
@@ -4457,6 +4458,7 @@ convert_numeric_to_scalar(Datum value, Oid typid, bool *failure)
44574458
case REGOPERATOROID:
44584459
case REGCLASSOID:
44594460
case REGTYPEOID:
4461+
case REGCOLLATIONOID:
44604462
case REGCONFIGOID:
44614463
case REGDICTIONARYOID:
44624464
case REGROLEOID:

src/backend/utils/cache/catcache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ GetCCHashEqFuncs(Oid keytype, CCHashFN *hashfunc, RegProcedure *eqfunc, CCFastEq
240240
case REGOPERATOROID:
241241
case REGCLASSOID:
242242
case REGTYPEOID:
243+
case REGCOLLATIONOID:
243244
case REGCONFIGOID:
244245
case REGDICTIONARYOID:
245246
case REGROLEOID:

0 commit comments

Comments
 (0)