agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Jolly Chen <[email protected]>
To: Bruce Ide <[email protected]>
Cc: [email protected]
Subject: Re: Inserting ' into a Postgres DB?
Date: Sun, 14 Jan 1996 23:03:02 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>



> 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 "[email protected]".
   If this fails, send mail to "[email protected]" 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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Inserting ' into a Postgres DB?
  In-Reply-To: <[email protected]>

* 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