aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r--src/backend/utils/adt/format_type.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c
index fc8733e960c..c85d7ea0884 100644
--- a/src/backend/utils/adt/format_type.c
+++ b/src/backend/utils/adt/format_type.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.27 2002/03/19 02:18:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.28 2002/03/20 19:44:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -123,10 +123,10 @@ format_type_internal(Oid type_oid, int32 typemod,
HeapTuple tuple;
Oid array_base_type;
int16 typlen;
+ char typtype;
bool is_array;
char *name;
char *buf;
- char typtype;
if (type_oid == InvalidOid && allow_invalid)
return pstrdup("-");
@@ -143,34 +143,16 @@ format_type_internal(Oid type_oid, int32 typemod,
type_oid);
}
+ /*
+ * Check if it's an array (and not a domain --- we don't want to show
+ * the substructure of a domain type). Fixed-length array types such
+ * as "name" shouldn't get deconstructed either.
+ */
array_base_type = ((Form_pg_type) GETSTRUCT(tuple))->typelem;
typlen = ((Form_pg_type) GETSTRUCT(tuple))->typlen;
typtype = ((Form_pg_type) GETSTRUCT(tuple))->typtype;
- /*
- * Domains look alot like arrays, so lets process them first, and return
- * back to avoid the array and 'standard' formatting procedures that are
- * use for base types.
- */
- if (typtype == 'd') {
- name = NameStr(((Form_pg_type) GETSTRUCT(tuple))->typname);
-
- /*
- * Double-quote the name if it's not a standard identifier.
- * Note this is *necessary* for ruleutils.c's use.
- */
- if (strspn(name, "abcdefghijklmnopqrstuvwxyz0123456789_") != strlen(name)
- || isdigit((unsigned char) name[0]))
- buf = psnprintf(strlen(name) + 3, "\"%s\"", name);
- else
- buf = pstrdup(name);
-
- ReleaseSysCache(tuple);
-
- return buf;
- }
-
- if (array_base_type != InvalidOid && typlen < 0)
+ if (array_base_type != InvalidOid && typlen < 0 && typtype != 'd')
{
/* Switch our attention to the array element type */
ReleaseSysCache(tuple);