deparse: Add support for typmod for CREATE DOMAIN.
authorPetr Jelinek <pjmodos@pjmodos.net>
Sat, 20 Dec 2014 08:08:48 +0000 (09:08 +0100)
committerPetr Jelinek <pjmodos@pjmodos.net>
Mon, 12 Jan 2015 19:18:15 +0000 (20:18 +0100)
src/backend/tcop/deparse_utility.c

index 2839168546a7516f169b6ff90e04a18b46880b9d..bcfd6d3adb70de8bf864d5ade0909d87880240ce 100644 (file)
@@ -2627,7 +2627,7 @@ deparse_CreateDomain(Oid objectId, Node *parsetree)
        elog(ERROR, "cache lookup failed for domain with OID %u", objectId);
    typForm = (Form_pg_type) GETSTRUCT(typTup);
 
-   createDomain = new_objtree_VA("CREATE DOMAIN %{identity}D AS %{type}D %{not_null}s %{constraints}s %{collation}s",
+   createDomain = new_objtree_VA("CREATE DOMAIN %{identity}D AS %{type}T %{not_null}s %{constraints}s %{collation}s",
                                  0);
 
    append_object_object(createDomain,
@@ -2636,8 +2636,7 @@ deparse_CreateDomain(Oid objectId, Node *parsetree)
                                                     objectId));
    append_object_object(createDomain,
                         "type",
-                        new_objtree_for_qualname_id(TypeRelationId,
-                                                    typForm->typbasetype));
+                        new_objtree_for_type(objectId, typForm->typtypmod));
 
    if (typForm->typnotnull)
        append_string_object(createDomain, "not_null", "NOT NULL");