Re: [SQL] Insert query

Поиск
Список
Период
Сортировка
От Holger Mitterwald
Тема Re: [SQL] Insert query
Дата
Msg-id Pine.HPP.3.95.980714151931.8971A-100000@hp00076.ina.de
обсуждение исходный текст
Ответ на Insert query  (Paulo Trezentos <Paulo.Trezentos@iscte.pt>)
Список 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 по дате отправления:

Предыдущее
От: Konstantinos Vassiliadis
Дата:
Сообщение: Typecasting in SQL functions
Следующее
От: Danny Rice
Дата:
Сообщение: How do you remove a field from a table?