[GRASSLIST:7185] Re: r.to.pg

Paul Kelly paul-grass at stjohnspoint.co.uk
Thu Jun 16 06:34:32 EDT 2005

On Thu, 16 Jun 2005, Moritz Lennert wrote:

> On Thu, June 16, 2005 11:22, Firman Hadi said:
>> cat: /home/firman/.grassrc5: No such file or directory
>> Please select database with g.select.pg or db.connect
>> I have tried to use g.select.pg but it wasn't change anything.
>> What I get from this error message is GRASS tried to read .grassrc5, but
>> GRASS 5.4 that I used is
>> reading .grassrc54.
>> Is there anybody can help?
> ln -s .grassrc54 .grassrc5

It would be better to fix the bug in r.to.pg. I see it does:

# check for database settings
DB_DATABASE=`cat ~/.grassrc5 | grep DB_DATABASE| cut -d' ' -f2`

which looks very hackish.

As I understand it the correct way to do this would be more like:

DB_DATABASE=`eval g.gisenv get=DB_DATABASE`

This assumes these database variables are GRASS variables stored in the 
.grassrc file. Which I think they are; I have never used the database 
support in GRASS <5.7.

Could you try changing that line in the r.to.pg script; also the following
  DB_DATABASE=`cat ~/.grassrc5 | grep PG_DBASE| cut -d' ' -f2`
should be changed to
  DB_DATABASE=`eval g.gisenv get=PG_DBASE`

Does that work?


More information about the grass-user mailing list