Re: [SQL] Insert query - Mailing list pgsql-sql

From Holger Mitterwald
Subject Re: [SQL] Insert query
Date
Msg-id Pine.HPP.3.95.980714151931.8971A-100000@hp00076.ina.de
Whole thread Raw
In response to Insert query  (Paulo Trezentos <Paulo.Trezentos@iscte.pt>)
List 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



pgsql-sql by date:

Previous
From: Konstantinos Vassiliadis
Date:
Subject: Typecasting in SQL functions
Next
From: Danny Rice
Date:
Subject: How do you remove a field from a table?