Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit da29cc8

Browse files
committed
Simplify psql's new linestyle behavior to default to linestyle=ascii all
the time, rather than hoping we can tell whether the terminal supports UTF8 characters. Per discussion.
1 parent f6a79c5 commit da29cc8

File tree

6 files changed

+15
-19
lines changed

6 files changed

+15
-19
lines changed

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

Lines changed: 2 additions & 7 deletions
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.234 2009/11/22 22:06:30 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.235 2009/11/25 20:26:30 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -1785,6 +1785,7 @@ lo_import 152801
17851785
or <literal>unicode</literal>.
17861786
Unique abbreviations are allowed. (That would mean one
17871787
letter is enough.)
1788+
The default setting is <literal>ascii</>.
17881789
This option only affects the <literal>aligned</> and
17891790
<literal>wrapped</> output formats.
17901791
</para>
@@ -1826,12 +1827,6 @@ lo_import 152801
18261827
Plain <acronym>ASCII</acronym> characters work everywhere, but
18271828
Unicode characters look nicer on displays that recognize them.
18281829
</para>
1829-
1830-
<para>
1831-
If this option has not been set, the default behavior is to use
1832-
<literal>unicode</literal> style if the client character set encoding
1833-
is UTF-8, otherwise <literal>ascii</literal> style.
1834-
</para>
18351830
</listitem>
18361831
</varlistentry>
18371832

doc/src/sgml/release-8.5.sgml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/release-8.5.sgml,v 1.6 2009/10/21 19:43:06 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/release-8.5.sgml,v 1.7 2009/11/25 20:26:31 tgl Exp $ -->
22

33
<sect1 id="release-8-5">
44
<title>Release 8.5alpha2</title>
@@ -410,8 +410,7 @@
410410
<emphasis>Add &quot;pset linestyle ascii/unicode&quot; option to psql,
411411
allowing our traditional ASCII-art style of table output to
412412
be upgraded to use Unicode box drawing characters if
413-
desired. By default, psql will use the Unicode characters
414-
whenever client_encoding is UTF8.</>
413+
desired.
415414
</para>
416415
</listitem>
417416
<listitem>

src/bin/psql/mbprint.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.36 2009/10/13 21:04:01 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.37 2009/11/25 20:26:31 tgl Exp $
77
*
88
* XXX this file does not really belong in psql/. Perhaps move to libpq?
99
* It also seems that the mbvalidate function is redundant with existing
@@ -30,7 +30,7 @@
3030

3131
typedef unsigned int pg_wchar;
3232

33-
int
33+
static int
3434
pg_get_utf8_id(void)
3535
{
3636
static int utf8_id = -1;

src/bin/psql/mbprint.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.14 2009/10/13 21:04:01 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.15 2009/11/25 20:26:31 tgl Exp $ */
22
#ifndef MBPRINT_H
33
#define MBPRINT_H
44

@@ -9,7 +9,6 @@ struct lineptr
99
int width;
1010
};
1111

12-
extern int pg_get_utf8_id(void);
1312
extern unsigned char *mbvalidate(unsigned char *pwcs, int encoding);
1413
extern int pg_wcswidth(const unsigned char *pwcs, size_t len, int encoding);
1514
extern void pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, struct lineptr * lines, int count);

src/bin/psql/print.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.118 2009/11/22 05:20:41 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.119 2009/11/25 20:26:31 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -2550,10 +2550,13 @@ setDecimalLocale(void)
25502550
const printTextFormat *
25512551
get_line_style(const printTableOpt *opt)
25522552
{
2553+
/*
2554+
* Note: this function mainly exists to preserve the convention that
2555+
* a printTableOpt struct can be initialized to zeroes to get default
2556+
* behavior.
2557+
*/
25532558
if (opt->line_style != NULL)
25542559
return opt->line_style;
2555-
else if (opt->encoding == pg_get_utf8_id())
2556-
return &pg_utf8format;
25572560
else
25582561
return &pg_asciiformat;
25592562
}

src/test/regress/pg_regress_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.7 2009/10/13 21:04:01 tgl Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.8 2009/11/25 20:26:31 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -59,7 +59,7 @@ psql_start_test(const char *testname,
5959
add_stringlist_item(expectfiles, expectfile);
6060

6161
snprintf(psql_cmd, sizeof(psql_cmd),
62-
SYSTEMQUOTE "\"%s%spsql\" -X -a -q -P linestyle=ascii -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
62+
SYSTEMQUOTE "\"%s%spsql\" -X -a -q -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
6363
psqldir ? psqldir : "",
6464
psqldir ? "/" : "",
6565
dblist->str,

0 commit comments

Comments
 (0)