Commit 45a19efa authored by Bruce Momjian's avatar Bruce Momjian

Change numericsep to a boolean, and make it locale-aware.

parent 4a8bbbd2
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.146 2005/07/10 03:46:12 momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.147 2005/07/14 08:42:36 momjian Exp $
PostgreSQL documentation
-->
......@@ -1496,10 +1496,9 @@ lo_import 152801
<term><literal>numericsep</literal></term>
<listitem>
<para>
Specifies the character separator between groups of three digits
to the left of the decimal marker. The default is <literal>''</>
(none). Setting this to a period also changes the decimal marker
to a comma.
Toggles the display of a locale-aware character to separate groups
of digits to the left of the decimal marker. It also enables
a locale-aware decimal marker.
</para>
</listitem>
</varlistentry>
......
......@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.148 2005/07/14 06:49:58 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.149 2005/07/14 08:42:37 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
......@@ -1420,15 +1420,17 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
: _("Expanded display is off.\n"));
}
/* numeric separators */
else if (strcmp(param, "numericsep") == 0)
{
if (value)
popt->topt.numericSep = !popt->topt.numericSep;
if (!quiet)
{
free(popt->topt.numericSep);
popt->topt.numericSep = pg_strdup(value);
if (popt->topt.numericSep)
puts(_("Showing numeric separators."));
else
puts(_("Numeric separators are off."));
}
if (!quiet)
printf(_("Numeric separator is \"%s\".\n"), popt->topt.numericSep);
}
/* null display */
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.26 2005/07/10 03:46:13 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.27 2005/07/14 08:42:37 momjian Exp $
*/
#ifndef PRINT_H
#define PRINT_H
......@@ -40,7 +40,8 @@ typedef struct _printTableOpt
char *fieldSep; /* field separator for unaligned text mode */
char *recordSep; /* record separator for unaligned text
* mode */
char *numericSep; /* numeric units separator */
bool numericSep; /* locale-aware numeric units separator and
* decimal marker */
char *tableAttr; /* attributes for HTML <table ...> */
int encoding; /* character encoding */
bool normal_query; /* are we presenting the results of a
......@@ -86,6 +87,8 @@ typedef struct _printQueryOpt
void printQuery(const PGresult *result, const printQueryOpt *opt,
FILE *fout, FILE *flog);
void setDecimalLocale(void);
#ifndef __CYGWIN__
#define DEFAULT_PAGER "more"
#else
......
......@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.118 2005/06/21 04:02:33 tgl Exp $
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.119 2005/07/14 08:42:37 momjian Exp $
*/
#include "postgres_fe.h"
......@@ -130,6 +130,7 @@ main(int argc, char *argv[])
setvbuf(stderr, NULL, _IONBF, 0);
setup_win32_locks();
#endif
setDecimalLocale();
pset.cur_cmd_source = stdin;
pset.cur_cmd_interactive = false;
pset.encoding = PQenv2encoding();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment