*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.3 1996/07/22 08:36:59 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.4 1996/07/27 02:29:51 scrappy Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
* - Added single. quote to twin single quote expansion for 'insert' string
* mode.
*
+ * Modifications - 7/26/96 - asussman@vidya.com
+ *
+ * - Fixed ouput lengths for char and varchar type where the length is variable (-1)
+ *
*-------------------------------------------------------------------------
*/
/* Show lengths on bpchar and varchar */
if (!strcmp(tblinfo[i].typnames[j],"bpchar")) {
- sprintf(q, "%s%s%s char(%d)",
+ sprintf(q, "%s%s%s char",
q,
(actual_atts > 0) ? ", " : "",
- tblinfo[i].attnames[j],
- tblinfo[i].attlen[j]);
+ tblinfo[i].attnames[j]);
+
+ /* stored length can be -1 (variable) */
+ if (tblinfo[i].attlen[j] > 0)
+ sprintf(q, "%s(%d)",
+ q,
+ tblinfo[i].attlen[j]);
actual_atts++;
}
else if (!strcmp(tblinfo[i].typnames[j],"varchar")) {
- sprintf(q, "%s%s%s %s(%d)",
+ sprintf(q, "%s%s%s %s",
q,
(actual_atts > 0) ? ", " : "",
tblinfo[i].attnames[j],
- tblinfo[i].typnames[j],
- tblinfo[i].attlen[j]);
+ tblinfo[i].typnames[j]);
+
+ /* stored length can be -1 (variable) */
+ if (tblinfo[i].attlen[j] > 0)
+ sprintf(q, "%s(%d)",
+ q,
+ tblinfo[i].attlen[j]);
actual_atts++;
}
else {