Return-Path: owner-postman Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id XAA23856 for postgres-redist; Sun, 14 Jan 1996 23:03:11 -0800 Resent-From: POSTGRES mailing list Resent-Message-Id: <199601150703.XAA23856@nobozo.CS.Berkeley.EDU> X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from arcadia.CS.Berkeley.EDU (arcadia.CS.Berkeley.EDU [128.32.37.59]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id XAA27195 for ; Sun, 14 Jan 1996 23:03:10 -0800 Received: from arcadia.CS.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by arcadia.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id XAA20858; Sun, 14 Jan 1996 23:03:02 -0800 From: Jolly Chen Message-Id: <199601150703.XAA20858@arcadia.CS.Berkeley.EDU> To: Bruce Ide cc: postgres@postgres.Berkeley.EDU Subject: Re: Inserting ' into a Postgres DB? In-reply-to: Your message of "Sun, 14 Jan 1996 04:58:30 EST." Date: Sun, 14 Jan 1996 23:03:02 -0800 Resent-To: postgres-redist@postgres.Berkeley.EDU Resent-Date: Sun, 14 Jan 96 23:03:11 -0800 Resent-XMts: smtp > 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/