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

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

On Mon, Jul 09, 2007 at 10:17:37AM +0200, Jaros?aw Jasiewicz wrote:

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

Thanks for catching this one.
I have fixed the weird logic now. Also backported to GRASS 6.2.CVS.

Markus