1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Fix for Alter TABLE add column varchar(). Was causing zero length.

This commit is contained in:
Bruce Momjian
1996-11-17 04:23:10 +00:00
parent 620f014621
commit 4b130b2209

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.5 1996/11/06 08:21:30 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.6 1996/11/17 04:23:10 momjian Exp $
* *
* NOTES * NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated * The PortalExecutorHeapMemory crap needs to be eliminated
@ -444,7 +444,10 @@ PerformAddAttribute(char *relationName,
} }
namestrcpy(&(attribute->attname), (char*) key[1].sk_argument); namestrcpy(&(attribute->attname), (char*) key[1].sk_argument);
attribute->atttypid = typeTuple->t_oid; attribute->atttypid = typeTuple->t_oid;
attribute->attlen = form->typlen; if (form->typlen > 0)
attribute->attlen = form->typlen;
else /* bpchar and varchar */
attribute->attlen = colDef->typename->typlen;
attribute->attnum = i; attribute->attnum = i;
attribute->attbyval = form->typbyval; attribute->attbyval = form->typbyval;
attribute->attnelems = attnelems; attribute->attnelems = attnelems;