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

Re: Escape handling in COPY, strings, psql

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Sergey Ten <sergey(at)sourcelabs(dot)com>,"'Christopher Kings-Lynne'" <chriskl(at)familyhealth(dot)com(dot)au>,jason(at)sourcelabs(dot)com
Subject: Re: Escape handling in COPY, strings, psql
Date: 2005-05-30 14:28:17
Message-ID: 200505301428.j4UESH210277@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > I was suggesting ESCAPE 'string' or ESC 'string'.  The marker has to
> > be before the string so scan.l can alter its processing of the string
> > --- after the string is too late --- there is no way to undo any
> > escaping that has happened, and it might already be used by gram.y.
> 
> That pretty much corresponds to my E'string' proposal.  Both are 
> probably equally trivial to implement.

Right.  I think your E'' idea has the benefit of fitting with our
existing X'' and B'' modifiers.  It is also simpler and cleaner to do in
scan.l, so I think your idea is best.

> > I agree with Tom that COPY has to be left unchanged.  The fundamental
> > problem is the representation of NULL values, that I don't think we
> > can do without some escape mechanism.  Single-quote escapes works by
> > doubling them, but once you need to represent something more like
> > null's, I can't think of a solution without escapes.
> 
> Yes, I now realize that COPY has a whole set of different rules anyway, 
> so we can leave that out of this discussion.

Cool.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2005-05-30 14:51:39
Subject: Re: [HACKERS] patches for items from TODO list
Previous:From: Bruce MomjianDate: 2005-05-30 14:19:20
Subject: Re: Escape handling in COPY, strings, psql

pgsql-patches by date

Next:From: Peter EisentrautDate: 2005-05-30 14:34:21
Subject: Re: psql backslash consistency
Previous:From: Bruce MomjianDate: 2005-05-30 14:26:14
Subject: Re: psql backslash consistency

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