[postgis-users] using quotation for table columns

CYW cyw at dls.net
Fri Jun 2 10:40:28 PDT 2006


Thanks. Yes I used -k, and will drop it.
_cyw_

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Michael
Fuhr
Sent: Friday, June 02, 2006 11:09 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] using quotation for table columns

On Fri, Jun 02, 2006 at 09:23:56AM -0500, CYW wrote:
> For some tables I created with shp2pgsql, I have to use double quotations
> around all non-geom table columns in SQL, e.g.,
> 	SELECT "ID" FROM sometable;
> 
> If I do: 
> 	SELECT ID FROM sometable;
> It will say: column "id" does not exist.

PostgreSQL folds unquoted identifiers to lowercase, so if an
identifier was created with quotes and in uppercase or mixed case
then you'll need to quote that identifier whenever you reference
it.  See "Identifiers and Key Words" in the PostgreSQL documentation:

http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-ID
ENTIFIERS

shp2pgsql creates identifiers in lowercase unless you use the -k
option, which preserves the case found in the data.  Did you use -k
when you ran shp2pgsql?  If so, and if the identifiers in the data
were uppercase, then that would explain what you're seeing.

-- 
Michael Fuhr
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list