[GRASS5] [bug #3623] (grass) v.in.ogr fails when input contains a column 'CAT'

Maciek Sieczka werchowyna at epf.pl
Wed Sep 14 13:37:50 EDT 2005


From: "Hamish" <hamish_nospam at yahoo.com>

> use the cnames= option to rename the column to something non-reserved,

You are right in general.

But there is something more to it. If my input shapefile contains 'cat'
column (*lowercase*), it is imported without the error message as 'cat_'.
The error pops up only when the column name is 'CAT' - uppercase.

Neither behaviour is a good solution I think. Forcing 'cat_' is no good
because it may always happen that you want to export your vector file again
to shapefile for external processing and the import it back to Grass. Then
you end up with a message:

DBMI-DBF driver error:
Column 'cat_' already exists (duplicate name)
Cannot create table.
Error in db_execute_immediate()

No good.

My idea is that any time 'CAT' or 'cat' is present in the input, a warning
and instruction should be issued like:

"A column named 'CAT' or 'cat' is present in your input data. This column is
RESERVED for Grass to store "categories". Read more here:  (a link to where
the user he can read more about what "categories" in Grass are; but is there
such a place?). Please rename your 'CAT' or 'cat' using the cnames option in
v.in.ogr to override conflicting column name."

What do you think?

The other, automated, solution could be to rename 'cat' to, say, 'cat1'. And
if 'cat1' is present to 'cat2' etc. Same with 'CAT'. Any good?

Maciek

P.S.
I mean this solutions mainly to help Grass newbies. I imagine that could be 
quite a surprise for a newbie to read "Column 'CAT' already exists 
(duplicate name)" with no guiding why so and what to do with it to able to 
import his shapefile anyway. But maybe I'm just exagerating here. You 
decide. I'll complain ;). 




More information about the grass-dev mailing list