[postgis-users] QGIS SPIT import to POSTGIS -

rac88 rac88 at hawaii.edu
Tue Jul 13 13:36:54 PDT 2010


Luis,

Thanks for the reply.

All the items you mentioned had been addressed.

On further investigation I found the solution:

QGIS SPIT calls the has_schema_privilege function via the script "select
nspname from pg_namespace where has_schema_privilege(nspname, 'CREATE')".
Note the second term 'CREATE'. 

The function has_schema_privilege(schema, privilege) queries whether the
current user have the privilege for schema. 

For schemas, the CREATE privilege allows new objects to be created within
the schema. 

QGIS SPIT did not show the additional schemas as the user had been granted
the USAGE privilege only. For the user to create new tables in the schema
the user has to have CREATE privileges or ALL privileges or be the owner of
the schema (which gives the user ALL privileges).

Thanks all for the consideration of my problem.

Abe


Luís de Sousa wrote:
> 
> Hi Abe,
> 
> What version of QGis are you using? With 1.4 you need the following
> for a user to add a layer from postgis:
> 
> . The layer correctly identified in the geometry_columns table;
> . A primary key, or otherwise unique integer field, in the layer table;
> . Usage premissions on the schema where the layer is;
> . Select premissions on the layer itself;
> 
> With all this you should be able to load the layer into QGis.
> 
> Good luck,
> 
> Luís
> 
> On Fri, Jul 9, 2010 at 11:23 PM, rac88 <rac88 at hawaii.edu> wrote:
>>
>> I'm trying to use QGIS SPIT to load multiple shapefiles into PostGIS.
>> But,
>> for all users but my superuser, I can't see the non-public schemas.
>>
>> It sounds permission based but when I sign in as the user via PGAdmin or
>> via
>> psql I can access and view the schemas.
>>
>> The schemas were created within the postgis database so they should have
>> the
>> postgis extension - to confirm this I created a new schema from the
>> public
>> folder in the postgis database but this was not viewable either.
>>
>> I've included the schemas in the postgres.conf search_path also. And,
>> geometry columns are in the public.geometry_column table.
>>
>> Line 478 of qgsspit.cpp is the only SQL reference to the namespace I can
>> see
>> (QString schemaSql = "select nspname from pg_namespace where
>> has_schema_privilege(nspname, 'CREATE')";) and this works from both
>> PGAdmin
>> and psql. I also copied the function to the specific database and schema
>> to
>> determine if it was simply not finding the function but this didn't work
>> either.
>>
>> Yes I can revert back to shp2pgsql but I like the multiple files option
>> of
>> SPIT - otherwise, can someone assist with some vb script or batch file to
>> run shp2pgsql on files within a folder.
>>
>> Am I missing something else in the POSTGIS environment that may be
>> restricting this user's ability?
>>
>> Thanks.
>>
>> Abe.
>> --
>> View this message in context:
>> http://old.nabble.com/QGIS-SPIT-import-to-POSTGIS---tp29122870p29122870.html
>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 

-- 
View this message in context: http://old.nabble.com/QGIS-SPIT-import-to-POSTGIS---tp29122870p29155403.html
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list