<div dir="ltr"><br><br>On Tue, Nov 6, 2018 at 10:34 PM Rich Shepard <<a href="mailto:rshepard@appl-ecosys.com">rshepard@appl-ecosys.com</a>> wrote:<br>><br>> On Tue, 6 Nov 2018, Markus Metz wrote:<br>><br>> > Please check v.db.connect map=stations -p<br>> > and<br>> > db.connect -p<br>> > Is the table attached to the map stations really in the default database?<br>><br>> Markus M,<br>><br>> > db.connect -p<br>> driver: pg<br>> database: willamette-river-hg<br>> schema: group:<br>><br>>    Well, well, well. Here's the problem:<br>><br>> > v.db.connect map=stations -p<br>> Vector map <stations> is connected by:<br>> layer <1/stations> table <stations> in database<br>> </home/rshepard/data/grassdata/willamette_basin/mercury/sqlite/sqlite.db><br>> through driver <sqlite> with key <cat><br>><br>>    How can stations be seen in the default sqlite database when db.connect<br>> shows the table in the postgres database? What else is db.connect doing if<br>> it allows grass commands to ignore what it reports and defaults to the<br>> sqlite one?<br><div><br></div><div>Apparently the table (not the vector map) stations exists twice: once in the sqlite database, once in the pg willamette-river-hg database. This is the reason for the confusion.</div><div><br></div><div>A vector map can have a table that is not in the default database as reported by db.connect -p.<br></div><div>></div>>    I thought db.connect used the database to which it reported being<br>> connected.<br><div><br></div><div>db.connect as well as other db.* commands use the default database connection reported by db.connect -p unless specified, e.g.</div><div><br></div><div>db.describe tab=stations driver=sqlite database=/home/rshepard/data/grassdata/willamette_basin/mercury/sqlite/sqlite.db</div><div><br></div><div>></div>>    How do I remove the sqlite stations table so grass sees it in the<br><div>> connected postgres database?</div><div><br></div><div>You have to change the database connection for a given vector map with v.db.connect. To be safe (avoiding confusion) you might use v.db.droptable first. Make sure you transfer attribute values first, e.g. with db.copy.</div><div><br></div><div>Markus M<br></div><br></div>