From 4b130b2209800ce60bc0a8874dd728166853dd5b Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 17 Nov 1996 04:23:10 +0000 Subject: [PATCH] Fix for Alter TABLE add column varchar(). Was causing zero length. --- src/backend/commands/command.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c index 363b5d2a8e..99c06b66e3 100644 --- a/src/backend/commands/command.c +++ b/src/backend/commands/command.c @@ -7,7 +7,7 @@ * * * 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 * The PortalExecutorHeapMemory crap needs to be eliminated @@ -444,7 +444,10 @@ PerformAddAttribute(char *relationName, } namestrcpy(&(attribute->attname), (char*) key[1].sk_argument); 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->attbyval = form->typbyval; attribute->attnelems = attnelems; -- 2.40.0