/rtmp/casts_on_domains_02.patch

text/x-diff

Filename: /rtmp/casts_on_domains_02.patch
Type: text/x-diff
Part: 0
Message: Re: DOMAINs and CASTs

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/commands/functioncmds.c 13 0
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 03da168..a29c13c 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -1517,6 +1517,17 @@ CreateCast(CreateCastStmt *stmt)
                                 errmsg("target data type %s is a pseudo-type",
                                                TypeNameToString(stmt->targettype))));
 
+       /* no domains allowd */
+       if (sourcetyptype == TYPTYPE_DOMAIN)
+               ereport(ERROR,
+                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                errmsg("casts from domains are not implemented yet")));
+
+       if (targettyptype == TYPTYPE_DOMAIN)
+               ereport(ERROR,
+                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                errmsg("casts to domains are not implemented yet")));
+
        /* Permission check */
        if (!pg_type_ownercheck(sourcetypeid, GetUserId())
                && !pg_type_ownercheck(targettypeid, GetUserId()))
@@ -1672,11 +1683,13 @@ CreateCast(CreateCastStmt *stmt)
                 * etc. would have to be modified to look through domains to their
                 * base types.
                 */
+#ifdef NOT_USED
                if (sourcetyptype == TYPTYPE_DOMAIN ||
                        targettyptype == TYPTYPE_DOMAIN)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
                                         errmsg("domain data types must not be marked binary-compatible")));
+#endif
        }
 
        /*