Opened 9 months ago

Closed 6 months ago

#3601 closed defect (fixed)

db.connect: default answers depend on current DB settings

Reported by: mmetz Owned by: grass-dev@…
Priority: normal Milestone: 7.4.2
Component: Database Version: svn-trunk
Keywords: database, connection Cc:
CPU: All Platform: All

Description

The default answers depend on current DB connection settings.

Using GRASS defaults:

$ db.connect --help
[...]
Parameters:
    driver   Name of database driver
             options: dbf,ogr,pg,sqlite
             default: sqlite
  database   Name of database
             default: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
    schema   Database schema
     group   Default group of database users to which select privilege is granted

Now modify the default DB connection for the current mapset:

db.connect driver=pg database=mydb schema=grass_schema group=grass_group

New default answers:

$ db.connect --help
[...]
Parameters:
    driver   Name of database driver
             options: dbf,ogr,pg,sqlite
             default: pg              <-- !!!
  database   Name of database
             default: mydb            <-- !!!
    schema   Database schema
             default: grass_schema    <-- !!!
     group   Default group of database users to which select privilege is granted
             default: grass_group     <-- !!!

Consequently, resetting to GRASS default does not work:

$ db.connect -d
Default driver / database set to:
driver: sqlite
database: /media/storage/GRASSsample_data/nc_spm_08/user1/sqlite/sqlite.db

followed by

$ db.connect -g
driver=sqlite
database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
schema=grass_schema    <-- !!!
group=grass_group      <-- !!!

The confusion probably arises because there are two different default settings: the default settings as defined for the current mapset, and the GRASS default settings.

  • the default answers for db.connect should always be the GRASS defaults
  • resetting to GRASS default connection settings with db.connect -d must work

Change History (5)

comment:1 Changed 9 months ago by mmetz

In 72942:

db.connect: use GRASS default, not current parameters as default answer, fix setting from default and from user options (see #3601)

comment:2 Changed 9 months ago by mmetz

Fixed in trunk r72941,2. To be backported to relbr74 after testing.

comment:3 Changed 8 months ago by mmetz

In 73039:

db.connect: use GRASS default, not current parameters as default answer, fix setting from default and from user options (see #3601; backport trunk r72942)

comment:4 Changed 6 months ago by martinl

Seems to be fixed. Feel free to reopen if needed.

comment:5 Changed 6 months ago by martinl

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.