cast_domains.patch
text/x-patch
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/parser/parse_coerce.c | 0 | 0 |
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 0418972..7101499 100644
*** a/src/backend/parser/parse_coerce.c
--- b/src/backend/parser/parse_coerce.c
*************** find_coercion_pathway(Oid targetTypeId,
*** 1873,1885 ****
*funcid = InvalidOid;
! /* Perhaps the types are domains; if so, look at their base types */
! if (OidIsValid(sourceTypeId))
! sourceTypeId = getBaseType(sourceTypeId);
! if (OidIsValid(targetTypeId))
! targetTypeId = getBaseType(targetTypeId);
!
! /* Domains are always coercible to and from their base type */
if (sourceTypeId == targetTypeId)
return COERCION_PATH_RELABELTYPE;
--- 1873,1879 ----
*funcid = InvalidOid;
! /* If they are the same type will always be coercible */
if (sourceTypeId == targetTypeId)
return COERCION_PATH_RELABELTYPE;
*************** find_coercion_pathway(Oid targetTypeId,
*** 1888,1893 ****
--- 1882,1913 ----
ObjectIdGetDatum(sourceTypeId),
ObjectIdGetDatum(targetTypeId));
+ if (!HeapTupleIsValid(tuple))
+ {
+ Oid sourceBaseTypeId;
+ Oid targetBaseTypeId;
+
+ /* Perhaps the types are domains; if so, look at their base types */
+ if (OidIsValid(sourceTypeId))
+ sourceBaseTypeId = getBaseType(sourceTypeId);
+ if (OidIsValid(targetTypeId))
+ targetBaseTypeId = getBaseType(targetTypeId);
+
+ if ((sourceBaseTypeId != sourceTypeId) || (targetBaseTypeId != targetTypeId))
+ {
+ sourceTypeId = sourceBaseTypeId;
+ targetTypeId = targetBaseTypeId;
+
+ /* Domains are always coercible to and from their base type */
+ if (sourceTypeId == targetTypeId)
+ return COERCION_PATH_RELABELTYPE;
+
+ tuple = SearchSysCache2(CASTSOURCETARGET,
+ ObjectIdGetDatum(sourceTypeId),
+ ObjectIdGetDatum(targetTypeId));
+ }
+ }
+
if (HeapTupleIsValid(tuple))
{
Form_pg_cast castForm = (Form_pg_cast) GETSTRUCT(tuple);