|
20 | 20 | *
|
21 | 21 | *
|
22 | 22 | * IDENTIFICATION
|
23 |
| - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.3 1996/07/22 08:36:59 scrappy Exp $ |
| 23 | + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.4 1996/07/27 02:29:51 scrappy Exp $ |
24 | 24 | *
|
25 | 25 | * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
26 | 26 | *
|
|
35 | 35 | * - Added single. quote to twin single quote expansion for 'insert' string
|
36 | 36 | * mode.
|
37 | 37 | *
|
| 38 | + * Modifications - 7/26/96 - asussman@vidya.com |
| 39 | + * |
| 40 | + * - Fixed ouput lengths for char and varchar type where the length is variable (-1) |
| 41 | + * |
38 | 42 | *-------------------------------------------------------------------------
|
39 | 43 | */
|
40 | 44 |
|
@@ -1210,20 +1214,30 @@ void dumpTables(FILE* fout, TableInfo *tblinfo, int numTables,
|
1210 | 1214 |
|
1211 | 1215 | /* Show lengths on bpchar and varchar */
|
1212 | 1216 | if (!strcmp(tblinfo[i].typnames[j],"bpchar")) {
|
1213 |
| - sprintf(q, "%s%s%s char(%d)", |
| 1217 | + sprintf(q, "%s%s%s char", |
1214 | 1218 | q,
|
1215 | 1219 | (actual_atts > 0) ? ", " : "",
|
1216 |
| - tblinfo[i].attnames[j], |
1217 |
| - tblinfo[i].attlen[j]); |
| 1220 | + tblinfo[i].attnames[j]); |
| 1221 | + |
| 1222 | + /* stored length can be -1 (variable) */ |
| 1223 | + if (tblinfo[i].attlen[j] > 0) |
| 1224 | + sprintf(q, "%s(%d)", |
| 1225 | + q, |
| 1226 | + tblinfo[i].attlen[j]); |
1218 | 1227 | actual_atts++;
|
1219 | 1228 | }
|
1220 | 1229 | else if (!strcmp(tblinfo[i].typnames[j],"varchar")) {
|
1221 |
| - sprintf(q, "%s%s%s %s(%d)", |
| 1230 | + sprintf(q, "%s%s%s %s", |
1222 | 1231 | q,
|
1223 | 1232 | (actual_atts > 0) ? ", " : "",
|
1224 | 1233 | tblinfo[i].attnames[j],
|
1225 |
| - tblinfo[i].typnames[j], |
1226 |
| - tblinfo[i].attlen[j]); |
| 1234 | + tblinfo[i].typnames[j]); |
| 1235 | + |
| 1236 | + /* stored length can be -1 (variable) */ |
| 1237 | + if (tblinfo[i].attlen[j] > 0) |
| 1238 | + sprintf(q, "%s(%d)", |
| 1239 | + q, |
| 1240 | + tblinfo[i].attlen[j]); |
1227 | 1241 | actual_atts++;
|
1228 | 1242 | }
|
1229 | 1243 | else {
|
|
0 commit comments