diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml
index cd00b357d3c..1693063ad38 100644
--- a/doc/src/sgml/ref/create_type.sgml
+++ b/doc/src/sgml/ref/create_type.sgml
@@ -1,5 +1,5 @@
@@ -153,7 +153,8 @@ CREATE TYPE typename ( INPUT =
Storage alignment requirement of the data type. If specified, must
- be 'int4' or 'double';
+ be 'char', 'int2',
+ 'int4', or 'double';
the default is 'int4'.
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index a3316fc89af..f88343fa91e 100644
--- a/src/backend/commands/define.c
+++ b/src/backend/commands/define.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.57 2001/06/21 18:25:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.58 2001/08/03 20:47:40 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -547,7 +547,7 @@ DefineType(char *typeName, List *parameters)
char delimiter = DEFAULT_TYPDELIM;
char *shadow_type;
List *pl;
- char alignment = 'i';/* default alignment */
+ char alignment = 'i'; /* default alignment */
char storage = 'p'; /* default storage in TOAST */
/*
@@ -593,15 +593,26 @@ DefineType(char *typeName, List *parameters)
{
char *a = defGetString(defel);
+ /*
+ * Note: if argument was an unquoted identifier, parser will have
+ * applied xlateSqlType() to it, so be prepared to recognize
+ * translated type names as well as the nominal form.
+ */
if (strcasecmp(a, "double") == 0)
alignment = 'd';
+ else if (strcasecmp(a, "float8") == 0)
+ alignment = 'd';
else if (strcasecmp(a, "int4") == 0)
alignment = 'i';
+ else if (strcasecmp(a, "int2") == 0)
+ alignment = 's';
+ else if (strcasecmp(a, "char") == 0)
+ alignment = 'c';
+ else if (strcasecmp(a, "bpchar") == 0)
+ alignment = 'c';
else
- {
elog(ERROR, "DefineType: \"%s\" alignment not recognized",
a);
- }
}
else if (strcasecmp(defel->defname, "storage") == 0)
{
@@ -616,10 +627,8 @@ DefineType(char *typeName, List *parameters)
else if (strcasecmp(a, "main") == 0)
storage = 'm';
else
- {
elog(ERROR, "DefineType: \"%s\" storage not recognized",
a);
- }
}
else
{
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index c2bcbce4450..c4c9bc7e118 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.217 2001/08/03 19:43:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.218 2001/08/03 20:47:40 tgl Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
@@ -3190,19 +3190,22 @@ dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
(*deps)[depIdx++] = strdup(tinfo[i].typelem);
}
- /* XXX these are all the aligns currently handled by DefineType */
- if (strcmp(tinfo[i].typalign, "i") == 0)
+ if (strcmp(tinfo[i].typalign, "c") == 0)
+ appendPQExpBuffer(q, ", alignment = char");
+ else if (strcmp(tinfo[i].typalign, "s") == 0)
+ appendPQExpBuffer(q, ", alignment = int2");
+ else if (strcmp(tinfo[i].typalign, "i") == 0)
appendPQExpBuffer(q, ", alignment = int4");
else if (strcmp(tinfo[i].typalign, "d") == 0)
appendPQExpBuffer(q, ", alignment = double");
if (strcmp(tinfo[i].typstorage, "p") == 0)
appendPQExpBuffer(q, ", storage = plain");
- if (strcmp(tinfo[i].typstorage, "e") == 0)
+ else if (strcmp(tinfo[i].typstorage, "e") == 0)
appendPQExpBuffer(q, ", storage = external");
- if (strcmp(tinfo[i].typstorage, "x") == 0)
+ else if (strcmp(tinfo[i].typstorage, "x") == 0)
appendPQExpBuffer(q, ", storage = extended");
- if (strcmp(tinfo[i].typstorage, "m") == 0)
+ else if (strcmp(tinfo[i].typstorage, "m") == 0)
appendPQExpBuffer(q, ", storage = main");
if (tinfo[i].passedbyvalue)