appendStringInfo(buf, "ARRAY[");
get_rule_expr((Node *) arrayexpr->elements, context, true);
appendStringInfoChar(buf, ']');
+ /*
+ * If the array isn't empty, we assume its elements are
+ * coerced to the desired type. If it's empty, though, we
+ * need an explicit coercion to the array type.
+ */
+ if (arrayexpr->elements == NIL)
+ appendStringInfo(buf, "::%s",
+ format_type_with_typemod(arrayexpr->array_typeid, -1));
}
break;
ERROR: cannot remove parameter defaults from existing function
HINT: Use DROP FUNCTION first.
\df dfunc
- List of functions
- Schema | Name | Result data type | Argument data types
---------+-------+------------------+--------------------------------------
- public | dfunc | integer | VARIADIC a integer[] DEFAULT ARRAY[]
+ List of functions
+ Schema | Name | Result data type | Argument data types
+--------+-------+------------------+-------------------------------------------------
+ public | dfunc | integer | VARIADIC a integer[] DEFAULT ARRAY[]::integer[]
(1 row)
drop function dfunc(a variadic int[]);