-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Virtual layer not loaded correctly after re-opening a project #46834
Comments
It's the joined field that when the layer is loaded is not yet resolved. |
elpaso
added a commit
to elpaso/QGIS
that referenced
this issue
Jan 21, 2022
elpaso
added a commit
to elpaso/QGIS
that referenced
this issue
Jan 21, 2022
troopa81
pushed a commit
that referenced
this issue
Jan 24, 2022
qgis-bot
pushed a commit
that referenced
this issue
Jan 24, 2022
troopa81
pushed a commit
that referenced
this issue
Jan 24, 2022
nyalldawson
pushed a commit
that referenced
this issue
Feb 20, 2022
nyalldawson
pushed a commit
that referenced
this issue
Feb 21, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the bug or the crash?
A virtual table (with attributes as expected) is not loaded correcly after closing and new opening of project again, when the virtual table is created from a second virtuaI table which has a join to another layer in layer-properties.
(In my original project I made the join by layer properties and not by sql-query because the joined layer contains a virtual field with array-functions (which can not be made with sqlite-sql-query) - in this example the join might be made in another way before / in the sql-query but this nonsens-example was made to show the issue with simpler code).
Before closing the project the virtual layer has a correct, as-expected attribute-table. After reopening the project the "Handling unavailable layers"-dialog occurs for this virtual layer. If you keep the unavailable layer and go to Layer->Create layer->New Virtual Layer -> Add "unavailable layer"-definition as stored in project you will be able to recreate the attribute table as expected.
Because of convinience and issue #46831 it is not a good way to recreate the unavailable virtual layer every time after reopening the project.
(In my original-project I saw in some cases that
1)
the whole layer was unavailable (as described before)
or
2)
the virtual layer (which contained "group"-functions) could be loaded - but contained only a reduced number of fields (just them which were used to group the rows). All "min(my_field) my_field"-fields were not in the table again after reopening the project. This could not be reproduced - but may be related to 1)
)
I attached a small example-project.
test_project.zip
Steps to reproduce the issue
Use test-project
test_project.zip
or
New project
2.1.) Insert data table (table "test_data_vl")
2.2.) Insert table for join to virtual layer (table "types") in step 4)
create a virtual layer "test_virtual_layer_1" based on table 2.1 and add it to the project
create a join between "test_virtual_layer_1" and table 2.2 ("types") in layer-properties
create a virtual layer "test_virtual_layer_2" based on table 2.2 and add it to the project
Check the attribute table of "test_virtual_layer_2"
Save, close and reopen project
Keep unavailable layer
Select unavailable layer and Layer->Create Layer->New virtual layer ->add "test_virtual_layer_2"(unavailable layer) (with code as stored in project)
Check attribute table of "test_virtual_layer_2" again
Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: