[GRASSLIST:4145] grass & postgres

Daniel Isenegger disen at geo.unizh.ch
Tue Aug 10 05:29:06 EDT 2004


Hi list,
i work on grass5.7 and want to use postgres to store attribute tables.
I have a shapefile (siteid_o_s) imported into Grass and an attribute 
table (siteid_o_s) in postgres.
Now i try with db.copy to export the shapefile into postgrass

first a test:
v.db.connect -p map=siteid_o_s
field <1> table <siteid_o_s> in database 
</home/disen/data/grassdata/Upperengadine/disen/dbf/> through driver 
<dbf> with key <cat>
seems to work

the command:
db.copy from_driver=dbf from_database=./ from_table=siteid_o_s 
to_driver=pg to_database="dbname=mydb,user=disen" to_table=siteid_o_p
D3/3: db_copy_table():
  from driver = dbf, db = ./, table = siteid_o_s
  to driver = pg, db = dbname=mydb,user=disen, table = siteid_o_p, where 
= (null)
D3/3: db_driver_open_database() driver=pg database definition = 
'dbname=mydb,user=disen'
D3/3: parse_conn : dbname=mydb,user=disen
D3/3: token 0 : dbname=mydb
D3/3: token 1 : user=disen
D3/3: host = (null), port = (null), options = (null), tty = (null), 
dbname = mydb, user = disen, password = (null)
D3/3: pgtype = 16,      name = bool ->  type = 16
D3/3: pgtype = 18,      name = char ->  type = 9
D3/3: pgtype = 20,      name = int8 ->  type = 3
D3/3: pgtype = 21,      name = int2 ->  type = 1
D3/3: pgtype = 23,      name = int4 ->  type = 2
D3/3: pgtype = 25,      name = text ->  type = 12
D3/3: pgtype = 26,      name = oid ->   type = 5
D3/3: pgtype = 700,     name = float4 ->        type = 6
D3/3: pgtype = 701,     name = float8 ->        type = 7
D3/3: pgtype = 1042,    name = bpchar ->        type = 10
D3/3: pgtype = 1043,    name = varchar ->       type = 11
D3/3: pgtype = 1082,    name = date ->  type = 13
D3/3: pgtype = 1083,    name = time ->  type = 14
D3/3: pgtype = 1114,    name = timestamp ->     type = 15
D3/3: pgtype = 1700,    name = numeric ->       type = 8
D2/3: pg : BEGIN
D3/3: select * from siteid_o_s
D3/3: SQL statement parsed successfully
D2/3: find_table(): table = siteid_o_s
DBMI-DBF driver error:
Table 'siteid_o_s' doesn't exist.
Error in db_open_select_cursor()

WARNING: Cannot open select cursor: 'select * from siteid_o_s'
WARNING: Copy table failed

the same error log appears when using
- not shapefiles, but grass vectors
- not same name for file and table (in postgres)


any ideas what is wrong?

Thanks dani





More information about the grass-user mailing list