agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Jolly Chen <jolly@postgres.Berkeley.EDU>
To: Bruce Ide <root@greyfox.org>
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: Inserting ' into a Postgres DB?
Date: Sun, 14 Jan 1996 23:03:02 -0800
Message-ID: <199601150703.XAA20858@arcadia.CS.Berkeley.EDU> (raw)
In-Reply-To: <Pine.LNX.3.91.960114045704.12811B-100000@greyfox.vnet.net>



> Anyone know how to insert a ' into a Postgres DB? Can you just \ escape 
> it? I seem to remember trying a couple of things and they didn't work and 
> I didn't see it in the docs anywhere.
> 

either '' or \' should work.  There seems to be a small bug in the
corner case of ''''.   See examples below:


jolly=> create table testTBL (f1 text);
CREATE
jolly=> insert into testTBL values ('This is Jolly''s test');
INSERT 1140266
jolly=> insert into testTBL values ('\'');
INSERT 1140267
jolly=> select * from testTBL;
---------------
| f1          |
---------------
| This is Jolly's test|
---------------
| '           |
---------------
jolly=> insert into testTBL values ('''');
INSERT 1140268
jolly=> select * from testTBL;
---------------
| f1          |
---------------
| This is Jolly's test|
---------------
| '           |
---------------
|             |
---------------
jolly=> insert into testTBL values (' '' ');
INSERT 1140269
jolly=> select * from testTBL;
---------------
| f1          |
---------------
| This is Jolly's test|
---------------
| '           |
---------------
|             |
---------------
|  '          |
---------------


- Jolly

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: jolly@postgres.Berkeley.EDU, root@greyfox.org
  Subject: Re: Inserting ' into a Postgres DB?
  In-Reply-To: <199601150703.XAA20858@arcadia.CS.Berkeley.EDU>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox