[GRASS-user] v.to.db: copying all columns to table

Rich Shepard rshepard at appl-ecosys.com
Thu Nov 1 10:11:28 PDT 2018


   I used db.copy and created tables in postgres from those in the mapset's
sqlite tables by following the format in the examples and assumed that all
attribute data went along for the ride. Apparently not. Here's one table:

# \d fishes_pg
                              Table "public.fishes_pg"
        Column       |            Type             | Collation | Nullable | 
Default 
--------------------+-----------------------------+-----------+----------+-
  cat                | integer                     |           |          |
  recordid           | integer                     |           |          |
  locationid         | character varying(13)       |           |          |
  begft              | integer                     |           |          |
  endft              | integer                     |           |          |
  streamname         | character varying(100)      |           |          |
  streamandtribnames | character varying(160)      |           |          |
  specieid           | integer                     |           |          |
  species            | character varying(50)       |           |          |
  sciname            | character varying(50)       |           |          |
  runid              | integer                     |           |          |
  run                | character varying(50)       |           |          |
  subrunid           | integer                     |           |          |
  subrun             | character varying(50)       |           |          |
  lifehistoryid      | integer                     |           |          |
  lifehistorytype    | character varying(80)       |           |          |
  usetypeid          | integer                     |           |          |
  usetype            | character varying(50)       |           |          |
  refid              | integer                     |           |          |
  citation           | character varying(3600)     |           |          |
  url                | character varying(1000)     |           |          |
  company            | character varying(12)       |           |          |
  basisid            | integer                     |           |          |
  basis              | character varying(80)       |           |          |
  upddate            | timestamp without time zone |           |          |
  endextentid        | integer                     |           |          |
  shape_length       | double precision            |           |          |

and
# select * from fishes_pg limit 3
#

The table's empty.

   1. Is v.to.db the correct module for filling the table with data? If not,
what is?

   2. If v.to.db is the correct module, can all columns be filled with a
single command? The examples show one column only.

   Or, if db.copy can be rerun using the option 'select = *' then I'll do
this instead.

Rich




More information about the grass-user mailing list