[GRASS-dev] [GRASS GIS] #1951: Postgres database login problems in db.databases

GRASS GIS trac at osgeo.org
Sun Apr 28 02:44:53 PDT 2013


#1951: Postgres database login problems in db.databases
---------------------------+------------------------------------------------
 Reporter:  davidinosauro  |       Owner:  grass-dev@…              
     Type:  defect         |      Status:  new                      
 Priority:  normal         |   Milestone:                           
Component:  Default        |     Version:  svn-trunk                
 Keywords:                 |    Platform:  Linux                    
      Cpu:  x86-64         |  
---------------------------+------------------------------------------------

Comment(by davidinosauro):

 Update: Hoping the thing was easy enough for me to fix it, I browsed a
 while into the code, but I realized it is not as easy as it seems.

 I realized the problem in pygrass may be distinct from the one in
 db.databases, because pygrass directly calls psycopg2.connect (at
 source:/grass/trunk/lib/python/pygrass/vector/table.py#L641).

 But even if I found the place where the fix would probably go, I couldn't
 work out a way of getting the db credentials without explicitly reading
 from `~/.grass7/dblogin` or `~/.pgpass`, wich does not seem a good idea in
 terms of avoding code replication (even if I could not find it, I bet
 there is some c module which does exately this).

 I forgot to explitely mention the steps to reproduce:
  - Set up a postgres with password authentication (just to be sure, with
 no username equal to the unix user GRASS runs with, and with no
 `~/.pgpass` entry)
  - `db.connect` and `db.login` to that postgres
  - create a vector map with attribute table on that postgres (I used
 `v.in.ogr`)
  - from the python shell:
    {{{
 #!python
 from grass.pygrass.vector import VectorTopo # guess would be the same with
 Vector
 v = VectorTopo('map_name')
 v.open()
    }}}
  - same error would be generated from `db.databases`

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1951#comment:1>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list