From: | "paul butler" <paul(at)entropia(dot)co(dot)uk> |
---|---|
To: | "Chris Boget" <chris(at)wild(dot)net> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Simple query question |
Date: | 2002-12-23 13:46:00 |
Message-ID: | 05b5e51461317c2PCOW057M@blueyonder.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
From: "Chris Boget" <chris(at)wild(dot)net>
To: "PGSql Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: [NOVICE] Simple query question
Date sent: Mon, 23 Dec 2002 07:25:03 -0600
> I'm in the process of converting my site from MySQL to PGSQL and
> I've come across something odd that I can't find an explenation for in
> the documentation.
The section called basic sql commands, double quotes seem to be
reserved for objects(relations/attributes) though are not required so
if you double quote (or not quote) a value in a where clause pgsql
will look for the corresponding object and most likely fail. Always
enclose values in single quotes.
>
> All my MySQL queries use double quotes around the field value I am
> looking for. IE
>
> SELECT * FROM sessions WHERE session_name = "session_name"
>
> However, when I run that in PGSQL, I get an error message:
>
> ERROR: Attribute "session_name" not found
>
> But if I replace the double quotes with single quotes, the query runs
> fine.
> Where in the documentation can I find why that is?
>
> Also, in MySQL you could use \G after the query (instead of using a
> semi colon) so that the record set would be displayed with the columns
> vertical instead of horizontal. This is especially useful when you are
> using the command line. Does PGSQL have something like that? This
> is something else I couldn't find in the documentation.
In psql typing \x will toggle the display
hope this helps
Paul Butler
>
> thnx,
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
From | Date | Subject | |
---|---|---|---|
Next Message | Reshat Sabiq | 2002-12-23 14:12:19 | Re: Simple query question |
Previous Message | Chris Boget | 2002-12-23 13:25:03 | Simple query question |