Re: [SQL] Insert query

From: Holger Mitterwald <mittehlg(at)coi(dot)de>
To: Paulo Trezentos <Paulo(dot)Trezentos(at)iscte(dot)pt>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Insert query
Date: 1998-07-14 14:23:08
Message-ID: Pine.HPP.3.95.980714151931.8971A-100000@hp00076.ina.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 14 Jul 1998, Paulo Trezentos wrote:

> Dear Mr. Reader
>
> I would like to insert a tuple in a table. The problem is that one of my
> fields as a " ' ".
>
> The query is like this :
>
> INSERT INTO mytable VALUES ('field1','fiel ' d2');
>
> Is this a bug, or is there another way of inserting that tuple ?

psql for example expects a 6th "'" as end for the string. And it is
completely confused by the result :-)

To insert your obscure tuple, you have to 'escape' the "'".
Just try:

INSERT INTO mytable VALUES ('field1','fiel \' d2');
^^
the "'" is not interpreted as part of the sql-command but interpreted as
part of the string.

So long,
Holger

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Danny Rice 1998-07-14 19:36:47 How do you remove a field from a table?
Previous Message Konstantinos Vassiliadis 1998-07-14 13:00:23 Typecasting in SQL functions