Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73a7c32

Browse files
committed
Add psql \pset numericsep to allow output numbers like 100,000.0 or
100.000,0.Eugen Nedelcu
1 parentbe3aa30 commit73a7c32

File tree

5 files changed

+308
-87
lines changed

5 files changed

+308
-87
lines changed

‎doc/src/sgml/ref/psql-ref.sgml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.145 2005/06/14 02:57:38 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.146 2005/07/10 03:46:12 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -1492,6 +1492,18 @@ lo_import 152801
14921492
</listitem>
14931493
</varlistentry>
14941494

1495+
<varlistentry>
1496+
<term><literal>numericsep</literal></term>
1497+
<listitem>
1498+
<para>
1499+
Specifies the character separator between groups of three digits
1500+
to the left of the decimal marker. The default is <literal>''</>
1501+
(none). Setting this to a period also changes the decimal marker
1502+
to a comma.
1503+
</para>
1504+
</listitem>
1505+
</varlistentry>
1506+
14951507
<varlistentry>
14961508
<term><literal>recordsep</literal></term>
14971509
<listitem>

‎src/bin/psql/command.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.146 2005/06/13 06:36:22 neilc Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.147 2005/07/10 03:46:13 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"command.h"
@@ -838,7 +838,6 @@ exec_command(const char *cmd,
838838
elseif (strcmp(cmd,"x")==0)
839839
success=do_pset("expanded",NULL,&pset.popt,quiet);
840840

841-
842841
/* \z -- list table rights (equivalent to \dp) */
843842
elseif (strcmp(cmd,"z")==0)
844843
{
@@ -1421,6 +1420,17 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
14211420
:_("Expanded display is off.\n"));
14221421
}
14231422

1423+
elseif (strcmp(param,"numericsep")==0)
1424+
{
1425+
if (value)
1426+
{
1427+
free(popt->topt.numericSep);
1428+
popt->topt.numericSep=pg_strdup(value);
1429+
}
1430+
if (!quiet)
1431+
printf(_("Numeric separator is \"%s\".\n"),popt->topt.numericSep);
1432+
}
1433+
14241434
/* null display */
14251435
elseif (strcmp(param,"null")==0)
14261436
{

‎src/bin/psql/help.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.103 2005/07/06 03:14:48 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.104 2005/07/10 03:46:13 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"common.h"
@@ -239,7 +239,7 @@ slashUsage(unsigned short int pager)
239239
fprintf(output,_(" \\pset NAME [VALUE]\n"
240240
" set table output option\n"
241241
" (NAME := {format|border|expanded|fieldsep|footer|null|\n"
242-
" recordsep|tuples_only|title|tableattr|pager})\n"));
242+
"numericsep|recordsep|tuples_only|title|tableattr|pager})\n"));
243243
fprintf(output,_(" \\t show only rows (currently %s)\n"),
244244
ON(pset.popt.topt.tuples_only));
245245
fprintf(output,_(" \\T [STRING] set HTML <table> tag attributes, or unset if none\n"));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp