Skip to content

Commit eabd1b2

Browse files
committed
Have psql output tab as the proper number of spaces, rather than \x09.
1 parent 5adf98a commit eabd1b2

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/bin/psql/mbprint.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.31 2008/05/08 17:04:26 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.32 2008/05/08 19:11:36 momjian 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
@@ -321,6 +321,14 @@ pg_wcsformat(unsigned char *pwcs, size_t len, int encoding,
321321
linewidth += 2;
322322
ptr += 2;
323323
}
324+
else if (*pwcs == '\t') /* Tab */
325+
{
326+
do
327+
{
328+
*ptr++ = ' ';
329+
linewidth++;
330+
} while (linewidth % 8 != 0);
331+
}
324332
else if (w < 0) /* Other control char */
325333
{
326334
sprintf((char *) ptr, "\\x%02X", *pwcs);

src/test/regress/expected/prepare.out

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,17 @@ SELECT name, statement, parameter_types FROM pg_prepared_statements
155155
name | statement | parameter_types
156156
------+-----------------------------------------------------------------+--------------------------------------------------------
157157
q2 | PREPARE q2(text) AS | {text}
158-
: \x09SELECT datname, datistemplate, datallowconn
159-
: \x09FROM pg_database WHERE datname = $1;
158+
: SELECT datname, datistemplate, datallowconn
159+
: FROM pg_database WHERE datname = $1;
160160
q3 | PREPARE q3(text, int, float, boolean, oid, smallint) AS | {text,integer,"double precision",boolean,oid,smallint}
161-
: \x09SELECT * FROM tenk1 WHERE string4 = $1 AND (four = $2 OR
162-
: \x09ten = $3::bigint OR true = $4 OR oid = $5 OR odd = $6::int)
163-
: \x09ORDER BY unique1;
161+
: SELECT * FROM tenk1 WHERE string4 = $1 AND (four = $2 O
162+
; R
163+
: ten = $3::bigint OR true = $4 OR oid = $5 OR odd = $6::
164+
; int)
165+
: ORDER BY unique1;
164166
q5 | PREPARE q5(int, text) AS | {integer,text}
165-
: \x09SELECT * FROM tenk1 WHERE unique1 = $1 OR stringu1 = $2
166-
: \x09ORDER BY unique1;
167+
: SELECT * FROM tenk1 WHERE unique1 = $1 OR stringu1 = $2
168+
: ORDER BY unique1;
167169
q6 | PREPARE q6 AS | {integer,name}
168170
: SELECT * FROM tenk1 WHERE unique1 = $1 AND stringu1 = $2;
169171
q7 | PREPARE q7(unknown) AS | {path}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy