deparse/core: return the base type OID, not the array's
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 5 May 2014 21:49:54 +0000 (17:49 -0400)
committerAndres Freund <andres@anarazel.de>
Fri, 5 Sep 2014 20:07:11 +0000 (22:07 +0200)
DefineType should return the OID of the base type just created, not the
subsidiary array's.

src/backend/commands/typecmds.c

index 4606b9bca538fbf60f491ecea045f708f16d4a25..6c9f06da01b0dfdb720cdf03b389025bd49b6640 100644 (file)
@@ -597,37 +597,37 @@ DefineType(List *names, List *parameters)
    /* alignment must be 'i' or 'd' for arrays */
    alignment = (alignment == 'd') ? 'd' : 'i';
 
-   typoid = TypeCreate(array_oid,      /* force assignment of this type OID */
-                       array_type,     /* type name */
-                       typeNamespace,  /* namespace */
-                       InvalidOid,     /* relation oid (n/a here) */
-                       0,      /* relation kind (ditto) */
-                       GetUserId(),    /* owner's ID */
-                       -1,     /* internal size (always varlena) */
-                       TYPTYPE_BASE,   /* type-type (base type) */
-                       TYPCATEGORY_ARRAY,      /* type-category (array) */
-                       false,  /* array types are never preferred */
-                       delimiter,      /* array element delimiter */
-                       F_ARRAY_IN,     /* input procedure */
-                       F_ARRAY_OUT,    /* output procedure */
-                       F_ARRAY_RECV,   /* receive procedure */
-                       F_ARRAY_SEND,   /* send procedure */
-                       typmodinOid,    /* typmodin procedure */
-                       typmodoutOid,   /* typmodout procedure */
-                       F_ARRAY_TYPANALYZE,     /* analyze procedure */
-                       typoid, /* element type ID */
-                       true,   /* yes this is an array type */
-                       InvalidOid,     /* no further array type */
-                       InvalidOid,     /* base type ID */
-                       NULL,   /* never a default type value */
-                       NULL,   /* binary default isn't sent either */
-                       false,  /* never passed by value */
-                       alignment,      /* see above */
-                       'x',    /* ARRAY is always toastable */
-                       -1,     /* typMod (Domains only) */
-                       0,      /* Array dimensions of typbasetype */
-                       false,  /* Type NOT NULL */
-                       collation);     /* type's collation */
+   TypeCreate(array_oid,       /* force assignment of this type OID */
+              array_type,      /* type name */
+              typeNamespace,   /* namespace */
+              InvalidOid,      /* relation oid (n/a here) */
+              0,       /* relation kind (ditto) */
+              GetUserId(), /* owner's ID */
+              -1,      /* internal size (always varlena) */
+              TYPTYPE_BASE,    /* type-type (base type) */
+              TYPCATEGORY_ARRAY,       /* type-category (array) */
+              false,   /* array types are never preferred */
+              delimiter,       /* array element delimiter */
+              F_ARRAY_IN,      /* input procedure */
+              F_ARRAY_OUT, /* output procedure */
+              F_ARRAY_RECV,    /* receive procedure */
+              F_ARRAY_SEND,    /* send procedure */
+              typmodinOid, /* typmodin procedure */
+              typmodoutOid,    /* typmodout procedure */
+              F_ARRAY_TYPANALYZE,      /* analyze procedure */
+              typoid, /* element type ID */
+              true,    /* yes this is an array type */
+              InvalidOid,      /* no further array type */
+              InvalidOid,      /* base type ID */
+              NULL,    /* never a default type value */
+              NULL,    /* binary default isn't sent either */
+              false,   /* never passed by value */
+              alignment,       /* see above */
+              'x', /* ARRAY is always toastable */
+              -1,      /* typMod (Domains only) */
+              0,       /* Array dimensions of typbasetype */
+              false,   /* Type NOT NULL */
+              collation);      /* type's collation */
 
    pfree(array_type);