<HTML><BODY DEFANGED_STYLE="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Dec 15, 2005, at 2:34 AM, Radim Blazek wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">Each new vector will store attributes in database previously set by</FONT></P> <P DEFANGED_STYLE="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">db.connect. If you have a vector with attributes in dbf files,</FONT></P> <P DEFANGED_STYLE="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" DEFANGED_STYLE="font: 12.0px Helvetica">you set your db to postgres (db.connect driver=pg datbase=...)</FONT></P> <P DEFANGED_STYLE="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" DEFANGED_STYLE="font: 12.0px Helvetica">and then copy the old vector with g.copy the new one will use</FONT></P> <P DEFANGED_STYLE="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">postgres for attributes.</FONT></P></BLOCKQUOTE><BLOCKQUOTE type="cite"></BLOCKQUOTE></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here are the results of the above procedure using the spearfish data (I'm attempting to narrow down the possible sources of error):</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>1. I created a database named spearfish_soils in postgres</DIV><DIV>truffula:/usr/local/pgsql/bin kwythers$ psql -l</DIV><DIV>           List of databases</DIV><DIV>      Name       |  Owner   | Encoding  </DIV><DIV>-----------------+----------+-----------</DIV><DIV> postgres        | postgres | SQL_ASCII</DIV><DIV> spearfish_soils | kwythers | SQL_ASCII</DIV><DIV> template0       | postgres | SQL_ASCII</DIV><DIV> template1       | postgres | SQL_ASCII</DIV><DIV> timber          | kwythers | SQL_ASCII</DIV><DIV> ts2325          | kwythers | SQL_ASCII</DIV><DIV>(6 rows)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>2. I set the db connection to postgres with db.connect, then checked to make sure it was set properly</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>GRASS 6.1.cvs (spearfish60):~ &gt; db.connect -p</DIV><DIV>driver:pg</DIV><DIV>database:host=localhost,dbname=spearfish_soils</DIV><DIV>schema:(null)</DIV><DIV>group:(null)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>3. I used g.copy to copy soils from PERMANENT to spearfish_soils in the current mapset</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>GRASS 6.1.cvs (spearfish60):~ &gt; g.copy vect=soils,spearfish_soils</DIV><DIV>COPY [soils@PERMANENT] to current mapset as [spearfish_soils]</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BLOCKQUOTE type="cite"><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR style=""></DIV><BLOCKQUOTE type="cite"><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; ">GRASS 6.1.cvs (arrowhead_utm):~ &gt; db.copy from_driver=dbf</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; ">from_database=./ from_table=townships to_driver=pg</DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; ">to_database="host=localhost,dbname=ts2325" to_table=townships</DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR DEFANGED_STYLE=""></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; ">and got the error:</DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR style=""></DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; ">DBMI-DBF driver error:</DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; ">Table 'townships' doesn't exist.</DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 10px; ">Error in db_open_select_cursor()</DIV></BLOCKQUOTE><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR style=""></DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">That could be a bug in case you have townships.shp in your current directory.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR DEFANGED_STYLE=""></DIV><DIV DEFANGED_STYLE="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV></BLOCKQUOTE></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>4. Check to see that the vector file 'spearfish_soils' exists... it does</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>GRASS 6.1.cvs (spearfish60):~ &gt; g.list vect</DIV><DIV>----------------------------------------------</DIV><DIV>vector files available in mapset user1:</DIV><DIV>spearfish_soils</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>vector files available in mapset PERMANENT:</DIV><DIV>archsites       soils           t_9961_300      t_9961_500_bks  t_roads_second</DIV><DIV>bugsites        streams         t_9961_300_all  t_county        t_tracts</DIV><DIV>fields          t_9961_100      t_9961_300_bks  t_hydro         tractids</DIV><DIV>quads           t_9961_100_all  t_9961_400      t_powerlines    tracts</DIV><DIV>railroads       t_9961_100_bks  t_9961_400_all  t_rails         transport_misc</DIV><DIV>roads           t_9961_200      t_9961_400_bks  t_roads         trn_sites</DIV><DIV>rstrct_areas    t_9961_200_all  t_9961_500      t_roads_inf     twp_range</DIV><DIV>sections        t_9961_200_bks  t_9961_500_all  t_roads_prime</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>5. Check to see that the data was copied from dbf 'soils' to pg 'spearfish_soils'</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>spearfish_soils=# SELECT * FROM spearfish_soils;</DIV><DIV> cat | label </DIV><DIV>-----+-------</DIV><DIV>   1 | Aab</DIV><DIV>   2 | Ba</DIV><DIV>   3 | Bb</DIV><DIV>   4 | BcB</DIV><DIV>   5 | BcC</DIV><DIV>   6 | BeE</DIV><DIV>   7 | Bhe</DIV><DIV>   8 | Bkd</DIV><DIV>   9 | CBE</DIV><DIV>  10 | CaD</DIV><DIV>  11 | CaE</DIV><DIV>  12 | Cc</DIV><DIV>  13 | GBE</DIV><DIV>  14 | GaD</DIV><DIV>  15 | GcD</DIV><DIV>  16 | GdE</DIV><DIV>  17 | GeD</DIV><DIV>  18 | HBF</DIV><DIV>  19 | Ha</DIV><DIV>  20 | KaB</DIV><DIV>  21 | LaE</DIV><DIV>  22 | MaC</DIV><DIV>  23 | MaD</DIV><DIV>  24 | McD</DIV><DIV>  25 | NaB</DIV><DIV>  26 | NaC</DIV><DIV>  27 | Nac</DIV><DIV>  28 | NbD</DIV><DIV>  29 | NcD</DIV><DIV>  30 | NdB</DIV><DIV>  31 | NdC</DIV><DIV>  32 | PbE</DIV><DIV>  33 | PcB</DIV><DIV>  34 | PcD</DIV><DIV>  35 | Pe</DIV><DIV>  36 | RBF</DIV><DIV>  37 | RCF</DIV><DIV>  38 | RaE</DIV><DIV>  39 | SaA</DIV><DIV>  40 | SaB</DIV><DIV>  41 | SbB</DIV><DIV>  42 | Sd</DIV><DIV>  43 | ShA</DIV><DIV>  44 | Sk</DIV><DIV>  45 | TaA</DIV><DIV>  46 | TaB</DIV><DIV>  47 | TaC</DIV><DIV>  48 | VBF</DIV><DIV>  49 | VCE</DIV><DIV>  50 | VaA</DIV><DIV>  51 | VaB</DIV><DIV>  52 | VaC</DIV><DIV>  53 | WaA</DIV><DIV>  54 | Wb</DIV><DIV>(54 rows)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>spearfish_soils=# </DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR>So far so good. This is looking great!<DIV><BR class="khtml-block-placeholder"></DIV><DIV>6. use db.describe to check out the vector in GRASS</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>GRASS 6.1.cvs (spearfish60):~ &gt; db.describe table=spearfish_soils driver=pg database=spearfish_soils</DIV><DIV>DBMI-Postgres driver error:</DIV><DIV>select * from spearfish_soils where oid &lt; 0</DIV><DIV>ERROR:  column "oid" does not exist</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>What is oid? I can see from the columns that postgres printed out that I have only columns cat and label, no oid. Is this something that should have copied and did not?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Kirk</DIV><DIV><BR class="khtml-block-placeholder"></DIV></BODY></HTML>