<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.19 2001/03/24 02:35:25 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.20 2001/08/03 20:47:40 tgl Exp $
Postgres documentation
-->
<listitem>
<para>
Storage alignment requirement of the data type. If specified, must
- be '<literal>int4</literal>' or '<literal>double</literal>';
+ be '<literal>char</literal>', '<literal>int2</literal>',
+ '<literal>int4</literal>', or '<literal>double</literal>';
the default is '<literal>int4</literal>'.
</para>
</listitem>
*
*
* 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
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 */
/*
{
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)
{
else if (strcasecmp(a, "main") == 0)
storage = 'm';
else
- {
elog(ERROR, "DefineType: \"%s\" storage not recognized",
a);
- }
}
else
{
*
*
* 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
*
(*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)