[GRASS-user] v.patch ERROR: Column names differ

Hi

I tried the following:
v.patch -a -e in=sewer_digit@sewer out=sewer_MN --overwrite
and received:
ERROR: Column names differ

The columns names don't differ, only the order differs:
v.db.connect -c sewer_MN
TEXT|comment
INTEGER|cat
TEXT|pipe_id
DOUBLE PRECISION|pipe_length_m
DOUBLE PRECISION|pipe_size_mm

and:
v.db.connect -c sewer_digit@sewer
INTEGER|cat
TEXT|comment
TEXT|pipe_id
DOUBLE PRECISION|pipe_length_m
DOUBLE PRECISION|pipe_size_mm

I'm using 6.3.0RC3, sqlite and sewer_digit is in a different mapset. If I
have to re-order the columns do you have any tips on how to do this?

Regards

Craig
--
View this message in context: http://www.nabble.com/v.patch-ERROR%3A--Column-names-differ-tp15481183p15481183.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Craig,

On Thu, Feb 14, 2008 at 4:04 PM, Craig Leat <Craig@pid.co.za> wrote:

Hi

I tried the following:
v.patch -a -e in=sewer_digit@sewer out=sewer_MN --overwrite
and received:
ERROR: Column names differ

The columns names don't differ, only the order differs:
v.db.connect -c sewer_MN
TEXT|comment
INTEGER|cat
TEXT|pipe_id
DOUBLE PRECISION|pipe_length_m
DOUBLE PRECISION|pipe_size_mm

and:
v.db.connect -c sewer_digit@sewer
INTEGER|cat
TEXT|comment
TEXT|pipe_id
DOUBLE PRECISION|pipe_length_m
DOUBLE PRECISION|pipe_size_mm

I'm using 6.3.0RC3, sqlite and sewer_digit is in a different mapset. If I
have to re-order the columns do you have any tips on how to do this?

Mhh, the column oder will be indeed the problem.
New columns are added to the right, but that's obviously annoying to
do manually.
It should be a general SQL join problem - any experts here?

Markus

Markus Neteler schrieb:

Craig,

On Thu, Feb 14, 2008 at 4:04 PM, Craig Leat <Craig@pid.co.za> wrote:

Hi

I tried the following:
v.patch -a -e in=sewer_digit@sewer out=sewer_MN --overwrite
and received:
ERROR: Column names differ

The columns names don't differ, only the order differs:
v.db.connect -c sewer_MN
TEXT|comment
INTEGER|cat
TEXT|pipe_id
DOUBLE PRECISION|pipe_length_m
DOUBLE PRECISION|pipe_size_mm

and:
v.db.connect -c sewer_digit@sewer
INTEGER|cat
TEXT|comment
TEXT|pipe_id
DOUBLE PRECISION|pipe_length_m
DOUBLE PRECISION|pipe_size_mm

I'm using 6.3.0RC3, sqlite and sewer_digit is in a different mapset. If I
have to re-order the columns do you have any tips on how to do this?

Mhh, the column oder will be indeed the problem.
New columns are added to the right, but that's obviously annoying to
do manually.
It should be a general SQL join problem - any experts here?

Markus
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Hi,
I had a similar problem the other day while renaming columns. As Markus said its a problem that new columns are added to the right.So its a little tricky to get the correct order.
To see the current order use
db.select sewer_MN | line
this prints the first line of the table:
comment|cat|pipe_id|pipe_length_m|pipe_size_mm

Now use
v.db.renamecol sewer_MN col=pipe_length_m,pipe_length_m_tmp
and you get
db.select sewer_MN | line
comment|cat|pipe_id|pipe_size_mm|pipe_length_m_tmp

then use
v.db.renamecol sewer_MN col=pipe_length_m_tmp,pipe_length_m
and you get
db.select sewer_MN | line
comment|cat|pipe_id|pipe_size_mm|pipe_length_m

I also tried to export the file as a .csv with db.out.ogr, to sort it with awk and to import it again with db.in.ogr -
could be the fastest way, but I couldn't import it again *grmpf* :o/

Got some error-messages like
ERROR: Input DSN <file> not found or not readable

So the rename-thing may be intricately but it works.

cheers
om shantih
Philipp

Philipp Steigenberger wrote:

I had a similar problem the other day while renaming columns. As Markus said its a problem that new columns are added to the right.So its a little tricky to get the correct order.
To see the current order use
db.select sewer_MN | line
this prints the first line of the table:
comment|cat|pipe_id|pipe_length_m|pipe_size_mm

Now use
v.db.renamecol sewer_MN col=pipe_length_m,pipe_length_m_tmp
and you get
db.select sewer_MN | line
comment|cat|pipe_id|pipe_size_mm|pipe_length_m_tmp

Hi Philipp

Thanks very much for the pointer, the v.db.renamecol trick to re-order the columns worked for me.

Best regards

Craig.