Skip to content

Commit 921de09

Browse files
committed
Use ' ' escapes for leading spaces in table values, for use in
EXPLAIN output. Jean-Paul Argudo
1 parent 8563cca commit 921de09

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/bin/psql/print.c

Lines changed: 14 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/print.c,v 1.59 2005/06/14 02:57:41 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.60 2005/06/14 22:15:57 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "common.h"
@@ -595,8 +595,10 @@ void
595595
html_escaped_print(const char *in, FILE *fout)
596596
{
597597
const char *p;
598-
598+
bool leading_space = true;
599+
599600
for (p = in; *p; p++)
601+
{
600602
switch (*p)
601603
{
602604
case '&':
@@ -617,9 +619,19 @@ html_escaped_print(const char *in, FILE *fout)
617619
case '\'':
618620
fputs("'", fout);
619621
break;
622+
case ' ':
623+
/* protect leading space, for EXPLAIN output */
624+
if (leading_space)
625+
fputs(" ", fout);
626+
else
627+
fputs(" ", fout);
628+
break;
620629
default:
621630
fputc(*p, fout);
622631
}
632+
if (*p != ' ')
633+
leading_space = false;
634+
}
623635
}
624636

625637

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