[GRASSLIST:285] Re: d.vect.pg

Moritz Lennert mlennert at club.worldonline.be
Wed Jun 4 05:15:43 EDT 2003


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




More information about the grass-user mailing list