[GRASSLIST:2867] Re: php PostgreSQL frenzy - schema support in 5.7??

Radim Blazek blazek at itc.it
Mon Mar 8 04:15:11 EST 2004


On Monday 08 March 2004 21:21, francesco.pirotti wrote:
> Hi,
>
> I am on this crazy train writing scripts to make GRASS call phpPgAdmin (a
> PostgreSQL database manager based on PHP scripting)
> and viceversa.
>
> 1 -There is a question.  If I use v.in.ogr to throw my attributes table in
> a pg database which has several schemas, the SQL scripts gives me an error
> because I do not specify the schema.  Usually the schema is specified with
> its name before a dot before the table name.  For example:
> CREATE TABLE myschema.mytable
> The problem is that I do not know where to specify schema name in GRASS
> 5.7.  Is there a way??
>
> Thank you
> Francesco

Currently schemas are not supported in 5.7. 
I think, that it should be without problems to add optional 'schema' 
to v.database (set GV_SCHEMA) and append schema name to the table name in 
Vect_default_field_info().

Try to add in grass51/lib/vector/Vlib/field.c at row 276:
if ( G__getenv2 ( "GV_SCHEMA", G_VAR_MAPSET ) )
    sprintf ( buf, "%s.%s", G__getenv2 ( "GV_SCHEMA", G_VAR_MAPSET ), fi->table );
    fi->table = G_store ( buf );
}
then add in text editor in $GISDBASE/$LOCATION_NAME/$MAPSET/VAR row:
GV_SCHEMA: myschema

let us know if it works, I don't have postgres with schemas.

Radim




More information about the grass-user mailing list