Opened 9 years ago

Closed 5 years ago

#2576 closed defect (worksforme)

db.columns cannot find table created by v.overlay

Reported by: pertusus Owned by: grass-dev@…
Priority: minor Milestone: 7.6.2
Component: Vector Version: svn-releasebranch70
Keywords: Cc:
CPU: Unspecified Platform: Linux

Description

With svn 7.0.0 up-to-date (r64408). The table created by v.overlay can be queried by v.db.select, but db.columns does not find it:

v.overlay ainput=uno atype=area alayer=1 binput=due btype=area blayer=1 output=test_or operator=or olayer=1,0,0 --overwrite
db.columns test_or
WARNING: Table <test_or> not found in database
         <$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db> using driver <sqlite>

I attach a code to reproduce, using a very simple dataset from a tutorial on v.overlay.

No such issue in 6.4.4.

Attachments (1)

grass_bug_v_overlay.tar.gz (2.4 KB ) - added by pertusus 9 years ago.
reproducer (./setup_overlay.sh). You may need to change the code in grass_common_setup to find your grass installation

Download all attachments as: .zip

Change History (7)

by pertusus, 9 years ago

Attachment: grass_bug_v_overlay.tar.gz added

reproducer (./setup_overlay.sh). You may need to change the code in grass_common_setup to find your grass installation

in reply to:  description comment:1 by mmetz, 9 years ago

Replying to pertusus:

With svn 7.0.0 up-to-date (r64408). The table created by v.overlay can be queried by v.db.select, but db.columns does not find it:

v.overlay ainput=uno atype=area alayer=1 binput=due btype=area blayer=1 output=test_or operator=or olayer=1,0,0 --overwrite
db.columns test_or
WARNING: Table <test_or> not found in database
         <$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db> using driver <sqlite>

The name of the table created by v.overlay is test_or_1, not test_or. The reason is that v.overlay might create several tables for the output. Please use v.db.connect -g first.

comment:2 by pertusus, 9 years ago

Priority: normalminor

Ok, I see. I think that the documentation should reflect that, it seems to me to be non intuitive. At least it should be mentioned that the table name could be different from the vector name and that v.db.connect -g may be used to get the table name.

Here is some code I propose that could also (or a variation of) be in the documentation to show how to rename the table such that it has the same name as the vector. It works on 6.4.4, with the difference that v.db.connect separator= is fs=. It requires cut, hopefully using only POSIX semantics.

table_info=`v.db.connect -g test_or separator="|"`
table_name=`echo $table_info | cut -d '|' -f 2`
key_name=`echo $table_info | cut -d '|' -f 3`

if test $table_name != test_or; then
  v.db.connect map=test_or -d
  db.copy from_table=$table_name to_table=test_or
  v.db.connect map=test_or table=test_or key=$key_name
fi

comment:3 by martinl, 8 years ago

Milestone: 7.0.07.0.5

comment:4 by neteler, 7 years ago

Milestone: 7.0.57.0.6

comment:5 by neteler, 6 years ago

Milestone: 7.0.67.0.7

comment:6 by martinl, 5 years ago

Milestone: 7.0.77.6.2
Resolution: worksforme
Status: newclosed

Unable to reproduce in GRASS 7.6.0.

Note: See TracTickets for help on using tickets.