Re: Quote Question

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Greg Lindstrom <greg(dot)lindstrom(at)novasyshealth(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Quote Question
Date: 2005-03-30 16:22:20
Message-ID: E41793A4-A137-11D9-A2E3-000A95B03262@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-03-30 17:14:24 Re: Quote Question
Previous Message Greg Lindstrom 2005-03-30 15:31:37 Quote Question