Hi,
Can someone help with the following behaviour in GRASS 5.0.0?
I've imported a shapefile (via v.in.shape) and passed the associated dbf to PostGreSQL (via pg.in.dbf). All seems well with both the table and the vector file by comparison to the original in ArcGIS.
If I use the tcltkgrass interface to perform a d.vect.pg select it works, yet if I enter the same command at the command line it fails. The outputs are below - the difference seems to be that the command line version is stripping the quotes from the where clause.
Executing
SELECT Distinct _ID from globalebas_region where _name='Jamaica' and _ID is not null;
1 Rows
GRASS 5.0.0 > d.vect.pg key=_ID tab=globalebas_region where=_name='Jamaica' map=eba color=red
Executing
SELECT Distinct _ID from globalebas_region where _name=Jamaica and _ID is not null;
Error Connecting to Postgres:ERROR: Attribute "jamaica" not found
Mapset <dorme> in Location <global>
GRASS 5.0.0 >
As a follow up, neither command line nor GUI seems to be able to handle spaces in text strings in the where clause. If I replace 'Jamiaca' with 'Peru-Chile Pacific slope' in the GUI then I get the following:
Sorry <Pacific> is not a valid option
Sorry <Slope"> is not a valid option
At the command line, I get the following:
GRASS 5.0.0 > d.vect.pg key=_ID tab=globalebas_region where=_name='Peru-Chile Pacific slope' map=eba color=red
Executing
SELECT Distinct _ID from globalebas_region where _name=Peru-Chile Pacific slope and _ID is not null;
Error Connecting to Postgres:ERROR: parser: parse error at or near "Pacific" at character 69
Thanks in advance,
David
David Orme said:
Hi,
Can someone help with the following behaviour in GRASS 5.0.0?
I've imported a shapefile (via v.in.shape) and passed the associated
dbf to PostGreSQL (via pg.in.dbf). All seems well with both the table
and the vector file by comparison to the original in ArcGIS.
If I use the tcltkgrass interface to perform a d.vect.pg select it
works, yet if I enter the same command at the command line it fails.
The outputs are below - the difference seems to be that the command
line version is stripping the quotes from the where clause.
Executing
SELECT Distinct _ID from globalebas_region where _name='Jamaica' and
_ID is not null;
1 Rows
GRASS 5.0.0 > d.vect.pg key=_ID tab=globalebas_region
where=_name='Jamaica' map=eba color=red
Executing
SELECT Distinct _ID from globalebas_region where _name=Jamaica and
_ID is not null;
Error Connecting to Postgres:ERROR: Attribute "jamaica" not found
Mapset <dorme> in Location <global>
GRASS 5.0.0 >
As a follow up, neither command line nor GUI seems to be able to handle
spaces in text strings in the where clause. If I replace 'Jamiaca' with
'Peru-Chile Pacific slope' in the GUI then I get the following:
Sorry <Pacific> is not a valid option
Sorry <Slope"> is not a valid option
At the command line, I get the following:
GRASS 5.0.0 > d.vect.pg key=_ID tab=globalebas_region
where=_name='Peru-Chile Pacific slope' map=eba color=red
Executing
SELECT Distinct _ID from globalebas_region where _name=Peru-Chile
Pacific slope and _ID is not null;
Error Connecting to Postgres:ERROR: parser: parse error at or near
"Pacific" at character 69
Have you tried putting the entire where clause in double quotes:
d.vect.pg key=_ID tab=globalebas_region where="_name='Peru-Chile Pacific
slope'" map=eba color=red
Moritz
I tried that last night but only in the GUI version, where it produces the same fault i.e.
Sorry <Pacific> is not a valid option
Sorry <Slope'"> is not a valid option <- note extra double quote...
That threw me off and I didn't think to check quoting the whole where clause in the command line - which now works perfectly.
So something is going on with the tcltk implementation but I can now use the command line.
Many thanks!
David
On Wednesday, June 4, 2003, at 10:15 am, Moritz Lennert wrote:
David Orme said:
Hi,
Can someone help with the following behaviour in GRASS 5.0.0?
I've imported a shapefile (via v.in.shape) and passed the associated
dbf to PostGreSQL (via pg.in.dbf). All seems well with both the table
and the vector file by comparison to the original in ArcGIS.
If I use the tcltkgrass interface to perform a d.vect.pg select it
works, yet if I enter the same command at the command line it fails.
The outputs are below - the difference seems to be that the command
line version is stripping the quotes from the where clause.
Executing
SELECT Distinct _ID from globalebas_region where _name='Jamaica' and
_ID is not null;
1 Rows
GRASS 5.0.0 > d.vect.pg key=_ID tab=globalebas_region
where=_name='Jamaica' map=eba color=red
Executing
SELECT Distinct _ID from globalebas_region where _name=Jamaica and
_ID is not null;
Error Connecting to Postgres:ERROR: Attribute "jamaica" not found
Mapset <dorme> in Location <global>
GRASS 5.0.0 >
As a follow up, neither command line nor GUI seems to be able to handle
spaces in text strings in the where clause. If I replace 'Jamiaca' with
'Peru-Chile Pacific slope' in the GUI then I get the following:
Sorry <Pacific> is not a valid option
Sorry <Slope"> is not a valid option
At the command line, I get the following:
GRASS 5.0.0 > d.vect.pg key=_ID tab=globalebas_region
where=_name='Peru-Chile Pacific slope' map=eba color=red
Executing
SELECT Distinct _ID from globalebas_region where _name=Peru-Chile
Pacific slope and _ID is not null;
Error Connecting to Postgres:ERROR: parser: parse error at or near
"Pacific" at character 69
Have you tried putting the entire where clause in double quotes:
d.vect.pg key=_ID tab=globalebas_region where="_name='Peru-Chile Pacific
slope'" map=eba color=red
Moritz