-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postgresql materialized view doesn't open #21130
Comments
Author Name: zimirrr leonid (zimirrr leonid) but it opens layer with DBManager! |
Author Name: Jürgen Fischer (@jef-n) check the message log - 'tableoid' is probably not unique.
|
Author Name: zimirrr leonid (zimirrr leonid) i checked tableoid within my view, it is unique |
Author Name: Jürgen Fischer (@jef-n) zimirrr leonid wrote:
And output in the log that has more information about the origin of the problem? |
Author Name: zimirrr leonid (zimirrr leonid) Jürgen Fischer wrote:
"dbname='test_qgis' host=localhost port=5432 user='t' password='1' sslmode=disable key='tableoid' srid=4326 type=MULTIPOLYGON table="dspec1_qgis"."build_a_50k" (geo) sql= is an invalid layer - not loaded" |
Author Name: zimirrr leonid (zimirrr leonid) I tried new version qgis 2.10 |
Author Name: Jürgen Fischer (@jef-n) zimirrr leonid wrote:
Selecting the unique column should enable it. |
Author Name: zimirrr leonid (zimirrr leonid) I did some tests again. "DB Manager" adds views and materialized views, but only one per click in version 2.8 "Add Postgis Table(s)" adds simple views but not materialized views i use 'SELECT row_number() over () AS qgisid ...' for unique rowid |
Author Name: Jürgen Fischer (@jef-n) zimirrr leonid wrote:
In 2.8 it just adds a list of columns for the selection of the primary key and preselects the first - regardless of whether it's the unique one or not.
In 2.10 you need to select a primary key before the row is selectable. Neither 2.8 or 2.10 verify that the selected key is unique before you insert the layer (and if you "use estimated metadata" then that test is even skipped). |
Author Name: Nicolas Rochard (Nicolas Rochard) Hello,
Got same problem. If I execute a SQL query as
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman) Nicolas Rochard wrote:
I made some tests here, and the only way I don't get a view/materialized views added via the "add postgis layer" dialog, is by selecting a not proper column for primary key. A sample of your data, the SQL query to create the MV and the name of the column you are trying to use as PK would help here. Please leave feedback. |
Author Name: zimirrr leonid (zimirrr leonid) i use 'SELECT row_number() over () AS qgisid ' to create unique rowid i've just tested it in version 2.12.0 and that's how this MVs look like in "add postgis layer" dialog
|
Author Name: Giovanni Manghi (@gioman) zimirrr leonid wrote:
you see that the dialog has a horizontal scrollbar? you must scroll, look for the "primary key" column and there choose the pk for your view or mview.
|
Author Name: zimirrr leonid (zimirrr leonid) Sorry, didn't notice that))
|
Author Name: Giovanni Manghi (@gioman) zimirrr leonid wrote:
double click on "select" in the "feature id" column, and select a proper pk. |
Author Name: zimirrr leonid (zimirrr leonid) thx a lot. But why MV do need to be selected manualy and simple view don't? |
Author Name: Giovanni Manghi (@gioman) zimirrr leonid wrote:
I just tested and views behave exactly the same as the mv.
|
Author Name: zimirrr leonid (zimirrr leonid)
Original Redmine Issue: 13060
Affected QGIS version: 2.8.1
Redmine category:data_provider/postgis
I have postgresql postgresql-9.4.4-1-windows-x64 and postgis 2.1.7-1 installed
I created materialized view but qgis doesn't open them
The errormsg is:
dbname='test_qgis' host=localhost port=5432 user='t' password='1' sslmode=disable key='tableoid' srid=4326 type=MULTIPOLYGON table="dspec1_qgis"."build_a_50k" (geo) sql= is an invalid layer - not loaded
The text was updated successfully, but these errors were encountered: