mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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.
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.36 2009/10/13 21:04:01 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.37 2009/11/25 20:26:31 tgl Exp $
|
||||
*
|
||||
* XXX this file does not really belong in psql/. Perhaps move to libpq?
|
||||
* It also seems that the mbvalidate function is redundant with existing
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
typedef unsigned int pg_wchar;
|
||||
|
||||
int
|
||||
static int
|
||||
pg_get_utf8_id(void)
|
||||
{
|
||||
static int utf8_id = -1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.14 2009/10/13 21:04:01 tgl Exp $ */
|
||||
/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.15 2009/11/25 20:26:31 tgl Exp $ */
|
||||
#ifndef MBPRINT_H
|
||||
#define MBPRINT_H
|
||||
|
||||
@ -9,7 +9,6 @@ struct lineptr
|
||||
int width;
|
||||
};
|
||||
|
||||
extern int pg_get_utf8_id(void);
|
||||
extern unsigned char *mbvalidate(unsigned char *pwcs, int encoding);
|
||||
extern int pg_wcswidth(const unsigned char *pwcs, size_t len, int encoding);
|
||||
extern void pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, struct lineptr * lines, int count);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.118 2009/11/22 05:20:41 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.119 2009/11/25 20:26:31 tgl Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
|
||||
@ -2550,10 +2550,13 @@ setDecimalLocale(void)
|
||||
const printTextFormat *
|
||||
get_line_style(const printTableOpt *opt)
|
||||
{
|
||||
/*
|
||||
* Note: this function mainly exists to preserve the convention that
|
||||
* a printTableOpt struct can be initialized to zeroes to get default
|
||||
* behavior.
|
||||
*/
|
||||
if (opt->line_style != NULL)
|
||||
return opt->line_style;
|
||||
else if (opt->encoding == pg_get_utf8_id())
|
||||
return &pg_utf8format;
|
||||
else
|
||||
return &pg_asciiformat;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.7 2009/10/13 21:04:01 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.8 2009/11/25 20:26:31 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -59,7 +59,7 @@ psql_start_test(const char *testname,
|
||||
add_stringlist_item(expectfiles, expectfile);
|
||||
|
||||
snprintf(psql_cmd, sizeof(psql_cmd),
|
||||
SYSTEMQUOTE "\"%s%spsql\" -X -a -q -P linestyle=ascii -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
SYSTEMQUOTE "\"%s%spsql\" -X -a -q -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
psqldir ? psqldir : "",
|
||||
psqldir ? "/" : "",
|
||||
dblist->str,
|
||||
|
Reference in New Issue
Block a user