Commit 73a7c322 authored by Bruce Momjian's avatar Bruce Momjian

Add psql \pset numericsep to allow output numbers like 100,000.0 or

100.000,0.

Eugen Nedelcu
parent be3aa30d
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.145 2005/06/14 02:57:38 momjian Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.146 2005/07/10 03:46:12 momjian Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -1492,6 +1492,18 @@ lo_import 152801 ...@@ -1492,6 +1492,18 @@ lo_import 152801
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<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.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><literal>recordsep</literal></term> <term><literal>recordsep</literal></term>
<listitem> <listitem>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2005, PostgreSQL Global Development Group * Copyright (c) 2000-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.146 2005/06/13 06:36:22 neilc Exp $ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.147 2005/07/10 03:46:13 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "command.h" #include "command.h"
...@@ -838,7 +838,6 @@ exec_command(const char *cmd, ...@@ -838,7 +838,6 @@ exec_command(const char *cmd,
else if (strcmp(cmd, "x") == 0) else if (strcmp(cmd, "x") == 0)
success = do_pset("expanded", NULL, &pset.popt, quiet); success = do_pset("expanded", NULL, &pset.popt, quiet);
/* \z -- list table rights (equivalent to \dp) */ /* \z -- list table rights (equivalent to \dp) */
else if (strcmp(cmd, "z") == 0) else if (strcmp(cmd, "z") == 0)
{ {
...@@ -1421,6 +1420,17 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) ...@@ -1421,6 +1420,17 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
: _("Expanded display is off.\n")); : _("Expanded display is off.\n"));
} }
else if (strcmp(param, "numericsep") == 0)
{
if (value)
{
free(popt->topt.numericSep);
popt->topt.numericSep = pg_strdup(value);
}
if (!quiet)
printf(_("Numeric separator is \"%s\".\n"), popt->topt.numericSep);
}
/* null display */ /* null display */
else if (strcmp(param, "null") == 0) else if (strcmp(param, "null") == 0)
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2005, PostgreSQL Global Development Group * Copyright (c) 2000-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.103 2005/07/06 03:14:48 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.104 2005/07/10 03:46:13 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "common.h" #include "common.h"
...@@ -239,7 +239,7 @@ slashUsage(unsigned short int pager) ...@@ -239,7 +239,7 @@ slashUsage(unsigned short int pager)
fprintf(output, _(" \\pset NAME [VALUE]\n" fprintf(output, _(" \\pset NAME [VALUE]\n"
" set table output option\n" " set table output option\n"
" (NAME := {format|border|expanded|fieldsep|footer|null|\n" " (NAME := {format|border|expanded|fieldsep|footer|null|\n"
" recordsep|tuples_only|title|tableattr|pager})\n")); " numericsep|recordsep|tuples_only|title|tableattr|pager})\n"));
fprintf(output, _(" \\t show only rows (currently %s)\n"), fprintf(output, _(" \\t show only rows (currently %s)\n"),
ON(pset.popt.topt.tuples_only)); ON(pset.popt.topt.tuples_only));
fprintf(output, _(" \\T [STRING] set HTML <table> tag attributes, or unset if none\n")); fprintf(output, _(" \\T [STRING] set HTML <table> tag attributes, or unset if none\n"));
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2005, PostgreSQL Global Development Group * Copyright (c) 2000-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.25 2005/06/14 02:57:41 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.26 2005/07/10 03:46:13 momjian Exp $
*/ */
#ifndef PRINT_H #ifndef PRINT_H
#define PRINT_H #define PRINT_H
...@@ -40,6 +40,7 @@ typedef struct _printTableOpt ...@@ -40,6 +40,7 @@ typedef struct _printTableOpt
char *fieldSep; /* field separator for unaligned text mode */ char *fieldSep; /* field separator for unaligned text mode */
char *recordSep; /* record separator for unaligned text char *recordSep; /* record separator for unaligned text
* mode */ * mode */
char *numericSep; /* numeric units separator */
char *tableAttr; /* attributes for HTML <table ...> */ char *tableAttr; /* attributes for HTML <table ...> */
int encoding; /* character encoding */ int encoding; /* character encoding */
bool normal_query; /* are we presenting the results of a bool normal_query; /* are we presenting the results of a
......
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