[postgis-users] What's wrong with this point field?

Paul Ramsey pramsey at refractions.net
Thu Feb 15 14:46:44 PST 2007


Kind of. PostgreSQL is case-insensitive, "sort of", and it is the "sort 
of" which has bitten you.  If you do:

CREATE TABLE Foo ( Bar integer );

You'll get a table with foo and bar coerced down to lowercase.

If you do:

CREATE TABLE "Foo" ( "Bar" integer );

You'll get a table that preserves your original case, *but* in order to 
access the table and attribute names, all you references to them must 
now use the right case and use "" to enclose.

Because PgSQL can do mixed case, PostGIS must respect that, and when you 
did SELECT AddGeometryColumn('position','Pos',-1,'POINT',2) using a 
mixed-case attribute name, PostGIS respectfully preserved your case. 
Which means now you must use "" to reference it henceforth.

You'll find that:

INSERT INTO position ("Pos") VALUES ...

works. You might want to start again and do pos in lower case, for your 
future sanity.

Paul

Kurt Schwehr wrote:
> Hi All,
> 
> I am at a loss for what I am doing wrong here.  I am using postgres 
> 8.2.3 and postgis 1.2.1 on mac osx 10.4.8 with fink provided packages.
> 
> CREATE TABLE position ( key SERIAL PRIMARY KEY, MessageID INTEGER, 
> RepeatIndicator INTEGER, UserID INTEGER, NavigationStatus INTEGER, ROT 
> INTEGER, SOG DECIMAL(4,1), PositionAccuracy INTEGER, COG DECIMAL(4,1), 
> TrueHeading INTEGER, TimeStamp INTEGER, RegionalReserved INTEGER, Spare 
> INTEGER, RAIM BOOL, syncstate INTEGER, slottimeout INTEGER, slotoffset 
> INTEGER, cg_r VARCHAR(15), cg_sec INTEGER, cg_timestamp TIMESTAMP ); 
> SELECT AddGeometryColumn('position','Pos',-1,'POINT',2);
> 
> ais=# INSERT INTO position (pos) VALUES 
> (GeomFromText('POINT(-122.778191666 48.277336666)'));
> ERROR:  column "pos" of relation "position" does not exist
> 
> Am I doing something really dumb?
> 
> Thanks,
> -kurt
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 

   Paul Ramsey
   Refractions Research
   http://www.refractions.net
   pramsey at refractions.net
   Phone: 250-383-3022
   Cell: 250-885-0632



More information about the postgis-users mailing list