<div dir="ltr"><br><br>On Tue, Nov 6, 2018 at 11:57 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>> > Apparently the table (not the vector map) stations exists twice: once in<br>> > the sqlite database, once in the pg willamette-river-hg database. This is<br>> > the reason for the confusion. A vector map can have a table that is not in<br>> > the default database as reported by db.connect -p.<br>><br>> Markus M,<br>><br>>    I did not realize this. I thought that using db.connect with the pg driver<br>> would use that table exclusively. This is good to know.<br>><br>> > db.connect as well as other db.* commands use the default database<br>> > connection reported by db.connect -p unless specified, e.g.<br>><br>>    Well, it didn't here when I tried using the v.colors command. :-(<br>><br>> > You have to change the database connection for a given vector map with<br>> > v.db.connect. To be safe (avoiding confusion) you might use v.db.droptable<br>> > first. Make sure you transfer attribute values first, e.g. with db.copy.<br>><br>>    I had used db.copy to copy all the stations map tables to postgres except<br>> for the stations table because that existed first in the postgres database,<br>> and attributes there were expoorted and used with v.in.ascii to create the<br>> grass map.<br>><br>>    Changing the database connection to the sqlite default I thought the<br>> stations table was deleted:<br>><br><div>> > db.droptable -f driver=sqlite table=stations</div><div><br></div><div>I suggested v.db.droptable, not db.droptable. db.* commands work on databases whereas v.* commands work on vectors. Thus you need to use v.db.connect, not db.connect, to connect a table to a vector, e.g.:</div><div><br></div><div>v.db.connect map=stations driver=pg database="willamette-river-hg" table=stations layer=1</div><div><br></div><div>HTH,</div><div><br></div><div>Markus M<br></div><div><br></div>> Forcing ...<br>> WARNING: Deleting table <stations> which is attached to following map(s):<br>> WARNING: stations@mercury<br>><br>> but,<br>><br>> > db.connect driver=pg database="willamette-river-hg"<br>> GRASS 7.7.svn (willamette_basin):~/data/grassdata/willamette_basin > db.connect -p<br>> driver: pg<br>> database: willamette-river-hg<br>><br>> > v.colors -c map=stations use=attr column=howmany rules=rules.txt rgb_col=bin_col --o<br>> DBMI-SQLite driver error:<br>> Error in sqlite3_prepare(): select * from stations where oid < 0<br>> no such table: stations<br>><br>> DBMI-SQLite driver error:<br>> Error in sqlite3_prepare(): select * from stations where oid < 0<br>> no such table: stations<br>><br>> ERROR: Column <howmany> not found in table <stations><br>><br>> > db.connect -p driver: pg database: willamette-river-hg schema: group:<br>> GRASS 7.7.svn (willamette_basin):~/data/grassdata/willamette_basin<br>><br>> > v.db.connect map=stations -p Vector map <stations> is connected by: layer<br>> <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>>    So, grass tells me it dropped the sqlite database table, but it still<br>> looks for it when I run v.colors. I suppose I need to manually change the<br>> database type.<br>><br>> Regards,<br>><br>> Rich<br>> _______________________________________________<br>> grass-user mailing list<br>> <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a></div>