Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] backslash in psql output

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] backslash in psql output
Date: 1998-10-10 04:21:32
Message-ID: 361EE0CC.6F364FDD@alumni.caltech.edu (view raw or flat)
Thread:
Lists: pgsql-hackers
> > psql could have an option to re-escape strings, but imho by default
> > should display what is stored, not what was typed in originally.
> > pg_dump _should_ re-escape everything, so that it reloads properly.
> But what about backward compatability?  Aren't there people expecting
> psql output to show double backslashes?  What do we do to display 
> pipes in the output?

We can include a command-line option to re-enable the escapes. Anyone
can use that form, and can define an alias for it if they need.

I understand your concern about backward compatibility, but imho the
convention it was using makes things more confusing, especially for a
new user. I'm not certain (assuming things have changed recently) that
the new behavior is what I would want, but the old behavior was not one
I would have guessed at.

Using psql to pipe output to another program is the best example of why
one might _not_ want to re-escape the strings. If the goal is to use
data from the database, then that data is what you will want to see in
the pipe.

Anyway, in the long run I'd like to consider moving toward a "no-escape"
default output for psql. If you think that it is too short notice to
fully understand the ramifications of a change this close to release, or
if your "faithful correspondents" have cottage cheese for brains, then
go ahead and revert it ;) But I like the new behavior in principle...

                    - Tom

Another possibility is to make it a configuration option:

  ./configure --enable-psql-string-escapes

or something like that...

In response to

Responses

pgsql-hackers by date

Next:From: Thomas G. LockhartDate: 1998-10-10 04:37:37
Subject: Re: [HACKERS] Portability Issue in src/backend/port/snprintf.c (I think)
Previous:From: Paul A VixieDate: 1998-10-10 04:09:53
Subject: Re: hackers-digest V1 #1013

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group