[Qgis-developer] Error for postgres's provider when table(statement SELECT ) is outside public's schema

Ricardo Filipe Soares Garcia da ricardo.garcia.silva at gmail.com
Thu Dec 16 08:46:44 EST 2010


Noli

Concerning your problem with postgis, I cannot reproduce it here.
Maybe I am not clear on what you are trying to do.
If you want to create a new table in the public schema as the result
of your SQL query, you must:

- activate the 'load result in map canvas' checkbox
- input valid column names for the 'geometry column' and 'identifier
column' text boxes
- activate the 'save new layer to database' checkbox
- input a valid 'Table name' and 'Schema' in their respective text
boxes. if you want to save the table in the public schema, type
'public' (without the quotes)
- write a valid SQL query (maybe it is best to first test the query
without visualizing to the map canvas to make sure it works)

Best regards

On Thu, Dec 16, 2010 at 1:16 PM, Ricardo Filipe Soares Garcia da
<ricardo.garcia.silva at gmail.com> wrote:
> Hi Noli, Guiseppe, all
>
> I downloaded the spatialite sample database and ran your query.
> I could run it fine without the errors you mention. The problem here
> seems to be that I still need to write some documentation on how to
> use the plugin so that you (the user) can know how to operate it
> correctly ;)
>
> I will improve the Help page of the plugin in order to clarify these issues.
>
> As for your specific problem:
>
> the SQL query you are using is:
>
> Select * from Regions where NAME = 'VENETO'
>
> - If you only intend to visualize the results in the 'result' tab of
> the plugin, without loading to map canvas, it works fine just like
> this.
>
> - BUT, If you want to load the result of the query to the map canvas,
> you must ensure that the 'Geometry column' and 'Identifier column'
> text boxes are showing the correct values for your specific tables.
> Using a spatialite db, I've set the default values for these text
> boxes as 'geometry' and 'pkuid', but you need to confirm if your data
> are using these names as well. In this case, the correct values should
> be 'Geometry' and 'PK_UID'.
> You can check the names of the columns in an sqlite table by using the
> spatialite manager, or by running the following query:
>
> PRAGMA TABLE_INFO(table_name)
>
> If you use the wrong geometry and identifier values you may (or may
> not) still be able to visualize your data over the map canvas but the
> attribute values will come as ERROR.
>
>
> As for the deletion of tables from the spatialite db, there isn't a
> nice way of doing this. To the best of my knowledge you still have to
> manually create the SQL DROP TABLE... statement and also remove the
> triggers and geometry info from spatialite by running the SQL SELECT
> DiscardGeometryColumn...
> I think this feature will come around sooner or later. It belongs to
> the (spatialite)manager plugin, and, even if I miss it as well, I
> don't think it should be implemented in the custom db query plugin.
>
> Cheers
>
>
>
> On Thu, Dec 16, 2010 at 7:59 AM, Noli Sicad <nsicad at gmail.com> wrote:
>> In spatilalite, I use this query (below) now but still I got the same error.
>>
>> Select * from Regions where NAME = 'VENETO'
>> '
>>
>> On 12/16/10, Giuseppe Sucameli <sucameli at faunalia.it> wrote:
>>> Hi Noli,
>>> this one it's no a plugin error, it's a query syntax error.
>>> On Thu, Dec 16, 2010 at 5:33 AM, Noli Sicad <nsicad at gmail.com> wrote:
>>>
>>>> Select * from Regions where NAME = "VENETO"
>>>>
>>> You still use double quotes wrapping values, instead you must use single
>>> quotes.
>>> Double quotes are for identifiers like table name, schema name and column
>>> name.
>>>
>>
>
>
>
> --
> ___________________________ ___ __
> Ricardo Garcia Silva
>



-- 
___________________________ ___ __
Ricardo Garcia Silva


More information about the Qgis-developer mailing list