Skip to content

Commit 93df658

Browse files
committed
Fix numericlocale psql option when used with a null string and latex and troff
formats; a null string must not be formatted as a numeric. The more exotic formats latex and troff also incorrectly formatted all strings as numerics when numericlocale was on. Backpatch to 8.1 where numericlocale option was added. This fixes bug #5355 reported by Andy Lester.
1 parent d6a6f8c commit 93df658

File tree

3 files changed

+66
-142
lines changed

3 files changed

+66
-142
lines changed

src/bin/psql/describe.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
1010
*
11-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.238 2010/02/26 02:01:18 momjian Exp $
11+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.239 2010/03/01 20:55:45 heikki Exp $
1212
*/
1313
#include "postgres_fe.h"
1414

@@ -1349,10 +1349,10 @@ describeOneTableDetails(const char *schemaname,
13491349
for (i = 0; i < numrows; i++)
13501350
{
13511351
/* Column */
1352-
printTableAddCell(&cont, PQgetvalue(res, i, 0), false);
1352+
printTableAddCell(&cont, PQgetvalue(res, i, 0), false, false);
13531353

13541354
/* Type */
1355-
printTableAddCell(&cont, PQgetvalue(res, i, 1), false);
1355+
printTableAddCell(&cont, PQgetvalue(res, i, 1), false, false);
13561356

13571357
/* Modifiers: not null and default */
13581358
if (show_modifiers)
@@ -1373,16 +1373,16 @@ describeOneTableDetails(const char *schemaname,
13731373
}
13741374

13751375
modifiers[i] = pg_strdup(tmpbuf.data);
1376-
printTableAddCell(&cont, modifiers[i], false);
1376+
printTableAddCell(&cont, modifiers[i], false, false);
13771377
}
13781378

13791379
/* Value: for sequences only */
13801380
if (tableinfo.relkind == 'S')
1381-
printTableAddCell(&cont, seq_values[i], false);
1381+
printTableAddCell(&cont, seq_values[i], false, false);
13821382

13831383
/* Expression for index column */
13841384
if (tableinfo.relkind == 'i')
1385-
printTableAddCell(&cont, PQgetvalue(res, i, 5), false);
1385+
printTableAddCell(&cont, PQgetvalue(res, i, 5), false, false);
13861386

13871387
/* Storage and Description */
13881388
if (verbose)
@@ -1396,8 +1396,9 @@ describeOneTableDetails(const char *schemaname,
13961396
(storage[0] == 'x' ? "extended" :
13971397
(storage[0] == 'e' ? "external" :
13981398
"???")))),
1399-
false);
1400-
printTableAddCell(&cont, PQgetvalue(res, i, firstvcol + 1), false);
1399+
false, false);
1400+
printTableAddCell(&cont, PQgetvalue(res, i, firstvcol + 1),
1401+
false, false);
14011402
}
14021403
}
14031404

@@ -2243,7 +2244,7 @@ describeRoles(const char *pattern, bool verbose)
22432244

22442245
for (i = 0; i < nrows; i++)
22452246
{
2246-
printTableAddCell(&cont, PQgetvalue(res, i, 0), false);
2247+
printTableAddCell(&cont, PQgetvalue(res, i, 0), false, false);
22472248

22482249
resetPQExpBuffer(&buf);
22492250
if (strcmp(PQgetvalue(res, i, 1), "t") == 0)
@@ -2278,12 +2279,12 @@ describeRoles(const char *pattern, bool verbose)
22782279

22792280
attr[i] = pg_strdup(buf.data);
22802281

2281-
printTableAddCell(&cont, attr[i], false);
2282+
printTableAddCell(&cont, attr[i], false, false);
22822283

2283-
printTableAddCell(&cont, PQgetvalue(res, i, 7), false);
2284+
printTableAddCell(&cont, PQgetvalue(res, i, 7), false, false);
22842285

22852286
if (verbose && pset.sversion >= 80200)
2286-
printTableAddCell(&cont, PQgetvalue(res, i, 8), false);
2287+
printTableAddCell(&cont, PQgetvalue(res, i, 8), false, false);
22872288
}
22882289
termPQExpBuffer(&buf);
22892290

0 commit comments

Comments
 (0)