mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
Use ' ' escapes for leading spaces in table values, for use in
EXPLAIN output. Jean-Paul Argudo
This commit is contained in:
parent
8563ccae2c
commit
921de09e40
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
|
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.59 2005/06/14 02:57:41 momjian Exp $
|
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.60 2005/06/14 22:15:57 momjian Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -595,8 +595,10 @@ void
|
|||||||
html_escaped_print(const char *in, FILE *fout)
|
html_escaped_print(const char *in, FILE *fout)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
|
bool leading_space = true;
|
||||||
|
|
||||||
for (p = in; *p; p++)
|
for (p = in; *p; p++)
|
||||||
|
{
|
||||||
switch (*p)
|
switch (*p)
|
||||||
{
|
{
|
||||||
case '&':
|
case '&':
|
||||||
@ -617,9 +619,19 @@ html_escaped_print(const char *in, FILE *fout)
|
|||||||
case '\'':
|
case '\'':
|
||||||
fputs("'", fout);
|
fputs("'", fout);
|
||||||
break;
|
break;
|
||||||
|
case ' ':
|
||||||
|
/* protect leading space, for EXPLAIN output */
|
||||||
|
if (leading_space)
|
||||||
|
fputs(" ", fout);
|
||||||
|
else
|
||||||
|
fputs(" ", fout);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fputc(*p, fout);
|
fputc(*p, fout);
|
||||||
}
|
}
|
||||||
|
if (*p != ' ')
|
||||||
|
leading_space = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user