Re: Quote Question

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Quote Question
Дата
Msg-id E41793A4-A137-11D9-A2E3-000A95B03262@pgedit.com
обсуждение исходный текст
Ответ на Quote Question  (Greg Lindstrom <greg.lindstrom@novasyshealth.com>)
Ответы Re: Quote Question  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-novice
On Mar 30, 2005, at 10:31 AM, Greg Lindstrom wrote:

> INSERT INTO MYTABLE (VALUE_1, VALUE_2)
>     VALUES ("Hello", "")
>
> but I now get an error complaining about a "zero length delimited
> identifier".  Rats. So:
>
> 1.  What's going on above with single and double quotes?

In PostgreSQL, double quotes are only used to quote identifiers such as
tables and columns. You only need to do this if you want to include
non-standard characters in the identifier name (e.g. spaces) or need to
preserve case. For example,

INSERT INTO "My Table" ...

>
> 2.  How can I insert single (and double) ticks into my data fields?
>

You double the quote or use \

VALUES('Woman''s Health', '') or
VALUES('Woman\'s Health', '')

There should be a function in your pg Python interface to handle this
for you.


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


В списке pgsql-novice по дате отправления:

Предыдущее
От: Greg Lindstrom
Дата:
Сообщение: Quote Question
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Quote Question