mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
For some reason, CREATE TYPE has only accepted alignment specifications
of 'int4' and 'double'. Add 'char' and 'int2' to allow user-defined types to access the full set of supported alignments.
This commit is contained in:
@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user