/me wildly guessing here: if QGIS 'sees' different geom types, it is shown multiple in the browser isn't it, or am I mixing up things here..? Like if a layer has both points and lines? Is it possible that (because of the wrong metadata in your view?) that QGIS both 'guesses' a type and get's another type from your sdo_metadata? OR that you really have different types in your table?
As said: just guessing :-) What about creating this view with another name and just a few records? Regards, Richard Duivenvoorde On 10/6/21 12:37 AM, jonathan.pir...@sibelga.be wrote: > Hello, > > I created the issue here: > > https://github.com/qgis/QGIS/issues/45419 > > > You a right the primary key is recognized as primary key if I add it from the > browser. > > Nevertheless, I still have the issue that views are visible 2 times. > Therefore I suspect that there is an another issue that make view appearing 3 > time in the browser as well ass in the source manager. But I don't know if it > is a an oracle issue or if it is a qgis issue. > > Here is what I have in my browser: > > https://ibb.co/ncfB5ZT > > How does the browser construct the layer tree? > I saw in the code that if the table/view has multiple geometry column then it > create 2 layer. One by geometry column. > But apart from that. Is there any other qgis logic that might create multiple > layer from out the same oracle table/view? > > I saw in the log that qgis execute 2 times the same query like: > > 2021-10-06T00:12:41 WARNING SQL: SELECT DISTINCT > t."GEOSCHEMATIQUE".SDO_GTYPE FROM (SELECT "GEOSCHEMATIQUE" FROM > "ATLAS"."V_GIS_REGLETTEBT" WHERE "GEOSCHEMATIQUE" IS NOT NULL AND rownum > Erreur: ORA-00904: "GEOSCHEMATIQUE": invalid identifier > > 2021-10-06T00:12:41 WARNING SQL: SELECT DISTINCT > t."GEOSCHEMATIQUE".SDO_GTYPE FROM (SELECT "GEOSCHEMATIQUE" FROM > "ATLAS"."V_GIS_REGLETTEBT" WHERE "GEOSCHEMATIQUE" IS NOT NULL AND rownum > Erreur: ORA-00904: "GEOSCHEMATIQUE": invalid identifier > (please ignore the invalid identifier error, this come from the fact that the > geometry column name in my view is not the same the one recorder in the > all_sdo_geom_metadate view, I have to fix this) > > > Could it be that qgis execute 2 times the same code? > > Thanks > > Jonathan > > > > > -----Message d'origine----- > De : Julien Cabieces <julien.cabie...@oslandia.com> > Envoyé : mardi 5 octobre 2021 07:44 > À : Piraux Jonathan <jonathan.pir...@sibelga.be> > Cc : qgis-developer@lists.osgeo.org > Objet : Re: [QGIS-Developer] duplicate oracle views displayed in the layer > list > > > Hi, > > I take a quick look and there is something to be improved in data source > manager [1]. Could you open an issue? I'll fix it when I get a bit of time. > > Though, if you select your layer from browser and add it directly (not going > through data source manager), the primary keys will be autmatically detected. > > Kind regards, > Julien > > [1] > https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2fgithub.com%2fqgis%2fQGIS%2fblob%2fmaster%2fsrc%2fproviders%2foracle%2fqgsoraclesourceselect.cpp%23L79&umid=780a0b5f-df07-47e0-9067-f0d12d136c07&auth=36d1d20e74f91a1e26e6349f2f53f5bb05fa2020-145d981027346e5624c2dcd38adcf23f407df85f > > >> Hello, >> >> Thanks for your feedback. Is this PR integrated in qgis 3.16.9? I guess it >> is but I am not 100% sure. >> >> I took your unit test in order to test if the PR was working. But the result >> is still the same. My QGIS can't figure out what is the primary key of the >> view whereas Qgis can manage to detect the primary key on the table. >> >> Here is my sql script: >> >> CREATE TABLE "ATLAS"."TABLE_TESTPKS" (pk1 INTEGER, DESCRIPTION >> VARCHAR2(25), pk2 NUMBER, CONSTRAINT cons_pk PRIMARY KEY(pk1, pk2)); >> INSERT INTO ALTAS.TABLE_TESTPKS VALUES(1000,'Desc for 1st record', 1); >> INSERT INTO ATLAS.TABLE_TESTPKS VALUES(2000,'Desc for 2nd record', 2); >> CREATE OR REPLACE VIEW "ATLAS"."VIEW_TESTPKS" AS SELECT * FROM >> ATLAS.TABLE_TESTPKS; COMMIT; ALTER VIEW ATLAS.VIEW_TESTPKS ADD >> CONSTRAINT const_view_pks PRIMARY KEY (pk1,pk2) DISABLE; >> >> I also tried with only one primary key on the view: >> >> CREATE TABLE "ATLAS"."TABLE_TESTPKS3" (pk1 INTEGER, DESCRIPTION >> VARCHAR2(25), pk2 NUMBER, CONSTRAINT cons_pk3 PRIMARY KEY(pk1, pk2)); >> COMMIT; INSERT INTO TABLE_TESTPKS3 VALUES(1000,'Desc for 1st record', >> 1); INSERT INTO ATLAS.TABLE_TESTPKS3 VALUES(2000,'Desc for 2nd >> record', 2); CREATE OR REPLACE VIEW "ATLAS"."VIEW_TESTPKS3" AS SELECT >> * FROM ATLAS.TABLE_TESTPKS3 ; COMMIT; ALTER VIEW ATLAS.VIEW_TESTPKS3 >> ADD CONSTRAINT const_view_pks3 PRIMARY KEY (pk1) DISABLE; >> >> >> Then for both, I checked in the layer manager if qgis can recognize the id >> but qgis still offer me the possibility to define the primary key. >> >> Should open an issue? Or something is wrong in my way to test qgis? >> >> Jonathan >> >> >> >> >> >> >> >> -----Message d'origine----- >> De : Julien Cabieces <julien.cabie...@oslandia.com> Envoyé : lundi 4 >> octobre 2021 10:16 À : Piraux Jonathan <jonathan.pir...@sibelga.be> Cc >> : qgis-developer@lists.osgeo.org Objet : Re: [QGIS-Developer] >> duplicate oracle views displayed in the layer list >> >> >> Hi, >> >> Regarding the primary key in disabled mode, it should work since this >> PR: >> https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3 >> a%2f%2fgithub.com%2fqgis%2fQGIS%2fpull%2f35112&umid=0b5dbc0e-6bdc-453a >> -91ec-8a660054db2a&auth=7f6fc31f18215669cf004d4797887d3e13de5b8d-c69e2 >> 7dc0d3ac43d988d40510ffd17c7f0be14f0 >> >> Take a look about the test requests in the PR, maybe it'll give you an hint >> about why it doesn't work on your side. >> >> If not, could you please open an issue here: >> https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3 >> a%2f%2fgithub.com%2fqgis%2fQGIS%2fissues%2f&umid=0b5dbc0e-6bdc-453a-91 >> ec-8a660054db2a&auth=7f6fc31f18215669cf004d4797887d3e13de5b8d-5948a851 >> 307fe8df3701542c3952384de944f1c0 >> >> Kind regards, >> Julien >> >>> Hello, >>> >>> I can't figure out how I should configure my oracle db to avoid qgis to >>> duplicate oracle views in the layer manager. Like shown in the following >>> link: >>> >>> https://i.stack.imgur.com/esjuI.png >>> >>> On this image we can see that all oracle views are displayed 3 times: >>> >>> >>> * Once as an attribute table >>> * Once as a layer with a known primary key >>> * Once as a layer without a known primary key >>> >>> I though that the issue was link to the fact that the views had no primary >>> keys. This as I saw in the oracle provider code (qgsoracleprovider.cpp) >>> that there is logic to select a column of the view/table that could be a >>> primary key. >>> >>> Therefore, I tried to set a primary key on one view as Oracle allows it (in >>> disabled mode). But without any success. >>> >>> As any one a suggestion? An idea how I could correctly define my oracle >>> views? >>> >>> I am using Qgis 3.16.9 >>> >>> Thanks >>> >>> Jonathan >>> >>> >>> >>> >>> >>> >>> >>> >>> Disclaimer >>> >>> Le pr?sent courriel ainsi que ses annexes ?ventuelles peuvent contenir des >>> informations confidentielles et/ou prot?g?es par des droits de propri?t? >>> intellectuelle et sont destin?s ? l'usage exclusif du (des) destinataire(s) >>> susmentionn?(s). Toute utilisation - notamment, mais non exclusivement, >>> pour la reproduction, la communication ou la distribution totale ou >>> partielle sous quelque forme que ce soit - de leur contenu par des >>> personnes autres que le(s) destinataire(s) d?sign?(s) est interdite. Si >>> vous avez re?u ce courriel par erreur, veuillez en informer l'exp?diteur >>> soit par t?l?phone soit par courriel, et supprimer de tout ordinateur les >>> donn?es y aff?rentes. Merci de votre collaboration. En d?pit des >>> pr?cautions prises, des courriels peuvent ?tre intercept?s, modifi?s, >>> perdus, d?truits ou contenir des virus. Nous d?clinons toute responsabilit? >>> quant aux ?ventuels dommages ?ventuellement caus?s dans cette ?ventualit?. >>> Toute personne qui communique avec SIBELGA par courriel est suppos?e >>> accepter ce risque. >>> >>> Deze mail en zijn eventuele bijlagen kunnen informatie bevatten die >>> vertrouwelijk is en/of beschermd door intellectuele-eigendomsrechten en >>> zijn bestemd voor exclusief gebruik door voormelde geadresseerde(n). Elk >>> gebruik - onder meer, maar niet exclusief, voor volledige of gedeeltelijke >>> reproductie, communicatie of distributie, onder welke vorm ook - van de >>> inhoud ervan door andere personen dan de aangeduide geadresseerde(n), is >>> verboden. Hebt u deze mail per vergissing ontvangen, gelieve de verzender >>> daarvan per telefoon of mail te verwittigen, en de eraan gekoppelde >>> gegevens van elke computer te verwijderen. Met dank voor uw medewerking. >>> Ondanks de genomen voorzorgen, kunnen er mails worden onderschept, >>> gewijzigd, verloren, vernietigd of kunnen zij virussen bevatten. Wij wijzen >>> elke verantwoordelijkheid af met betrekking tot eventuele schade die in die >>> hypothese zou zijn veroorzaakt. Elke persoon die via mail met SIBELGA >>> communiceert, wordt geacht dat risico te aanvaarden. >>> >>> Sibelga<https://www.sibelga.be> >>> >>> _______________________________________________ >>> QGIS-Developer mailing list >>> QGIS-Developer@lists.osgeo.org >>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer >>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer >> >> >> Disclaimer >> >> Le présent courriel ainsi que ses annexes éventuelles peuvent contenir des >> informations confidentielles et/ou protégées par des droits de propriété >> intellectuelle et sont destinés á l'usage exclusif du (des) destinataire(s) >> susmentionné(s). Toute utilisation - notamment, mais non exclusivement, pour >> la reproduction, la communication ou la distribution totale ou partielle >> sous quelque forme que ce soit - de leur contenu par des personnes autres >> que le(s) destinataire(s) désigné(s) est interdite. Si vous avez reçu ce >> courriel par erreur, veuillez en informer l'expéditeur soit par téléphone >> soit par courriel, et supprimer de tout ordinateur les données y afférentes. >> Merci de votre collaboration. En dépit des précautions prises, des courriels >> peuvent être interceptés, modifiés, perdus, détruits ou contenir des virus. >> Nous déclinons toute responsabilité quant aux éventuels dommages >> éventuellement causés dans cette éventualité. Toute personne qui communique >> avec SIBELGA par courriel est supposée accepter ce risque. >> >> Deze mail en zijn eventuele bijlagen kunnen informatie bevatten die >> vertrouwelijk is en/of beschermd door intellectuele-eigendomsrechten en zijn >> bestemd voor exclusief gebruik door voormelde geadresseerde(n). Elk gebruik >> - onder meer, maar niet exclusief, voor volledige of gedeeltelijke >> reproductie, communicatie of distributie, onder welke vorm ook - van de >> inhoud ervan door andere personen dan de aangeduide geadresseerde(n), is >> verboden. Hebt u deze mail per vergissing ontvangen, gelieve de verzender >> daarvan per telefoon of mail te verwittigen, en de eraan gekoppelde gegevens >> van elke computer te verwijderen. Met dank voor uw medewerking. Ondanks de >> genomen voorzorgen, kunnen er mails worden onderschept, gewijzigd, verloren, >> vernietigd of kunnen zij virussen bevatten. Wij wijzen elke >> verantwoordelijkheid af met betrekking tot eventuele schade die in die >> hypothese zou zijn veroorzaakt. Elke persoon die via mail met SIBELGA >> communiceert, wordt geacht dat risico te aanvaarden. >> >> Sibelga<https://www.sibelga.be> > > > Disclaimer > > Le présent courriel ainsi que ses annexes éventuelles peuvent contenir des > informations confidentielles et/ou protégées par des droits de propriété > intellectuelle et sont destinés á l'usage exclusif du (des) destinataire(s) > susmentionné(s). Toute utilisation - notamment, mais non exclusivement, pour > la reproduction, la communication ou la distribution totale ou partielle sous > quelque forme que ce soit - de leur contenu par des personnes autres que > le(s) destinataire(s) désigné(s) est interdite. Si vous avez reçu ce courriel > par erreur, veuillez en informer l'expéditeur soit par téléphone soit par > courriel, et supprimer de tout ordinateur les données y afférentes. Merci de > votre collaboration. En dépit des précautions prises, des courriels peuvent > être interceptés, modifiés, perdus, détruits ou contenir des virus. Nous > déclinons toute responsabilité quant aux éventuels dommages éventuellement > causés dans cette éventualité. Toute personne qui communique avec SIBELGA par > courriel est supposée accepter ce risque. > > Deze mail en zijn eventuele bijlagen kunnen informatie bevatten die > vertrouwelijk is en/of beschermd door intellectuele-eigendomsrechten en zijn > bestemd voor exclusief gebruik door voormelde geadresseerde(n). Elk gebruik - > onder meer, maar niet exclusief, voor volledige of gedeeltelijke reproductie, > communicatie of distributie, onder welke vorm ook - van de inhoud ervan door > andere personen dan de aangeduide geadresseerde(n), is verboden. Hebt u deze > mail per vergissing ontvangen, gelieve de verzender daarvan per telefoon of > mail te verwittigen, en de eraan gekoppelde gegevens van elke computer te > verwijderen. Met dank voor uw medewerking. Ondanks de genomen voorzorgen, > kunnen er mails worden onderschept, gewijzigd, verloren, vernietigd of kunnen > zij virussen bevatten. Wij wijzen elke verantwoordelijkheid af met betrekking > tot eventuele schade die in die hypothese zou zijn veroorzaakt. Elke persoon > die via mail met SIBELGA communiceert, wordt geacht dat risico te aanvaarden. > > Sibelga<https://www.sibelga.be> > > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > _______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer