[GRASS-user] v.db.addtable - small issue

Jarosław Jasiewicz jarekj at amu.edu.pl
Mon Jul 9 04:17:37 EDT 2007


On script lines 162 - 168 there is small issue which make some problems 
with postgreSQL and others differ from dbf databases.

In that place the script try to create table and if error occured It 
assume that database is not created and create new default databse and 
set grass to use dbf as default driver

I found it, when I used v.db.addtable to add table to vector and made 
type mismatch in column type (flot4 instead of float4) script returns an 
error, but from that moment I had dbf instead of pgSQL as default 
database - without any warnings.

I think script shall on line 164 check if dirver is different from dbf 
and 'exit 1' if driver different from dbf or continue  script if driver 
if dbf

sometihing like:

echo "CREATE TABLE $table ($COLUMN_DEF)" | db.execute database=$database 
driver=$driver
    if [ $? -ne 0 ] ; then

        if [ "$driver" != "dbf" ] ; then
            g.mesage -e "Cannot create table" .......
            exit 1
        fi

........
greetings
Jarek




More information about the grass-user mailing list