pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Wentzel <wentzel@THWT.COM>
To: 'theofilu@eunet.at' <theofilu@eunet.at>
Cc: 'pgsql-interfaces@postgreSQL.org' <pgsql-interfaces@postgreSQL.org>
Subject: RE: [INTERFACES] Still have problem with single quotation mark
Date: Mon, 13 Sep 1999 16:26:29 -0400
Message-ID: <A1C69E9A4D29D311AFE000A024CA0B0B5EDA@snax.thwt.com> (raw)

>There is still a problem with the single quotation mark (') inside a
>string, when this string is inserted into the database and one uses 'ecpg'.
>Someone on this list told me, that I should precede a ' with a second '
>(''). Then it would not be interpreted as the end of string. I did this and
>realy, now it is not interpreted at all. 'ecpg' puts now both quotation
>marks into the database table. This makes for example the words 'I don't
>want this' appear as 'I don''t want this'. Preceding the quotation mark
>with a backslash does not help also. Then I get the SQL error 'too many
>arguments in line xxx'. This is really annoying. How can I fix this?


Try escape characters.  For example to place a single quote in a text field
use \' instead of ' the backslash tells SQL interpreter that the next
character
is not a special character but simply part of the string.  Other examples
are:

\\ interprets as a single backslash character in the string
\" interprets as a double quote character in the string

Hope this helps.


Mike Wentzel
THWT Software



view thread (5+ messages)  latest in thread

Message-ID: <A1C69E9A4D29D311AFE000A024CA0B0B5EDA@snax.thwt.com>
Permalink:  ../A1C69E9A4D29D311AFE000A024CA0B0B5EDA@snax.thwt.com/
Also on:    postgresql.org/message-id/A1C69E9A4D29D311AFE000A024CA0B0B5EDA@snax.thwt.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-interfaces@postgresql.org
  Cc: wentzel@THWT.COM, theofilu@eunet.at
  Subject: Re: [INTERFACES] Still have problem with single quotation mark
  In-Reply-To: <A1C69E9A4D29D311AFE000A024CA0B0B5EDA@snax.thwt.com>
  References: <A1C69E9A4D29D311AFE000A024CA0B0B5EDA@snax.thwt.com>

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

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