[mapserver-users] ogr connection to postgis problems

Even Rouault even.rouault at mines-paris.org
Wed Mar 25 16:05:49 EDT 2009


Travis,

this is really weird. I've reviewed a bit the source of the PG driver and the 
influence of the read-only mode vs update mode is very thin. The only 
behavioural differences are :
1) the result of TestCapabilities() method depend on it, but ogrinfo doesn't 
request layer TestCapabilities().
2) if the PG database has no valid tables (for OGR), its opening will fail in 
read-only mode, whereas it would succeed in update mode.

So in your use case, provided that there's at least one table reported by 
ogrinfo in update mode, I don't understand why it fails. What's the version 
of GDAL/OGR you're using ? 

Le Wednesday 25 March 2009 19:51:39 Travis Kirstine, vous avez écrit :
> 2009/3/25 Stephen Woodbridge <woodbri at swoodbridge.com>:
> > Jeff McKenna wrote:
> >> Travis Kirstine wrote:
> >>> I am trying to test a connection to a postgis db  using ogrinfo and am
> >>> having difficulties.  I am running the command on the same server that
> >>> hosts the postgis db.  I checked the pg_hba.config file to see if it
> >>> allows local connections and everything looks OK but I still get
> >>> "Failure" when connecting with ogr.
> >>>
> >>> Am I missing something?
> >>>
> >>>
> >>> command
> >>> ogrinfo -ro PG:'host=server34 dbname=earth user=bob password=suruncle'
> >>
> >> My thoughts:
> >>
> >> - since you are on the same server, use host=127.0.0.1
> >> - include the port parameter (usually port=5432)
> >
> > Have you try from the command line:
> >
> > psql -h server34 -U bob earth
> > psql -h localhost -U bob earth
> > psql -U bob earth
> >
> > Should prompt you for the password.
> >
> > Only the last on will use the local socket or named pipe. If the last one
> > works the try:
> >
> > ogrinfo -ro PG:'host= dbname=earth user=bob password=suruncle'
> > ogrinfo -ro PG:'dbname=earth user=bob password=suruncle'
> >
> > and see if either of these work.
>
> I got the query / connection to work, it seems that the -ro flag was
> causing the problem
> which is strange.
>
> this works
> ogrinfo -sql 'SELECT * FROM counties' PG:'host= dbname=earth user=bob
> password=suruncle'
>
> this dosen't
> ogrinfo -ro -sql 'SELECT * FROM counties' PG:'host= dbname=earth
> user=bob password=suruncle'
>
> I'm not sure what the problem is as the user bob has su privileges
>
>
>                                List of roles
>  Role name | Superuser | Create role | Create DB | Connections | Member of
> -----------+-----------+-------------+-----------+-------------+-----------
>  postgres  | yes       | yes         | yes       | no limit    |
>  bob          | yes       | no          | yes       | no limit    |




More information about the mapserver-users mailing list