[GRASS-dev] [GRASS GIS] #2576: db.columns cannot find table created by v.overlay

#2576: db.columns cannot find table created by v.overlay
-------------------------+--------------------------------------------------
Reporter: pertusus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2576&gt;
GRASS GIS <http://grass.osgeo.org>

#2576: db.columns cannot find table created by v.overlay
-------------------------+--------------------------------------------------
Reporter: pertusus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [ticket:2576 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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2576#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2576: db.columns cannot find table created by v.overlay
-------------------------+--------------------------------------------------
Reporter: pertusus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by pertusus):

  * priority: normal => minor

Comment:

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
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2576#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>