Dear Marco,

Thank you very much for your suggestions! It is not the solution, but the right direction. I tried a couple of things and, eventually, found a solution that indeed is related to primary keys/database indices. For the record, in case others stumble over the same problem:

 * In the mapping file, primary keys were exposed
 * I used database views to flatten the structure of some features
   (i.e. now primary key or unique index possible)
 * This setup worked with older geoserver versions (2.14 - 2.16, I guess)

Since then, something must have changed "under the hood", which resulted in the described problem and also some other issues that were difficult to pin down exactly.

 * I moved all normal database views to materialized views
 * This allows the generation of indices, and I generated a unique
   index on each of the materialized views

When this was done, all issues disappeared immediately and the App Schema based service worked again as before.

Best regards,

Henning



On 2022-10-07 14:57, Marco Volpini wrote:
Dear Henning,
you might try if setting the expose primary key flag to false, inside the datastore params in your app-schema mappings fixes the issue:
<Parameter>
   <name>Expose primary keys</name>
   <value>false</value>
</Parameter>
I'm not sure 100% sure it will work for your use case, but in this way GeoServer will generate random UUID for features FID instead of using the database primary key and if the same instance is not reused across feature chaining should lead to the desired result (however not exposing pk will probably cause performance degradation when querying the data). If this does not work then I believe that code changes after a careful code investigation are needed in order to support your use case.

Kind Regards,

Marco Volpini

==GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us <http://bit.ly/gs-services-us>for more information.==Marco Volpini

Software EngineerGeoSolutions Groupphone: +39 0584 962313

fax:     +39 0584 1660272


https://www.geosolutionsgroup.com/ <https://www.geosolutionsgroup.com/>

http://twitter.com/geosolutions_it <http://twitter.com/geosolutions_it>

-------------------------------------------------------


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.




On Thu, Oct 6, 2022 at 9:31 AM Henning Lorenz <henning.lor...@geo.uu.se> wrote:

    geoserver 2.21.1, Postgresql

    Hello,

    Question: How can I add randomness to App Schema idExpression
    while joining support is active? (then random() is not supported)

    Background:

      * App Schema automatically encodes the ids based on
        <tablename>.<primarykey>.
      * Ids have to be unique within the output document, else the
        document will not validate.

    If a mapping file repeatedly chains the same feature and there the
    same content (same line in the table, same primary key), the
    generated id is the same. (For me this happens with a mapping file
    that chains responsible party (gmd:CI_ResponsibleParty) in several
    places. When the same party is responsible more than once, the
    generated ids are the same and thus, the output document does not
    validate).

    As all data are the same in these multiple occurrences, the only
    solution I see is to add a random string/number. To concatenate
    random() in the idExpression is a solution in case joining support
    is deactivated. However, with activated joining support, it
    generates an error (only database functions are supported, as
    indicated in the documentation). But when I turn of joining
    support, JDBC multi values support seems to be deactivated as
    well. Thus, this is not a solution. Therefore, I need a solution
    for adding randomness while joining support is active.

    Thanks in advance for any help on this topic,

    Henning

    The funny thing is that the same app schema mapping with random()
    and multiple values did work and produce valid output on a now
    decommissioned server. The geoserver version was in the range
    2.14-2.16, and I can't recall whether joining support was active.
    Maybe it just was a coincidence, or something has changed in
    geoserver.









    När du har kontakt med oss på Uppsala universitet med e-post så
    innebär det att vi behandlar dina personuppgifter. För att läsa
    mer om hur vi gör det kan du läsa här:
    http://www.uu.se/om-uu/dataskydd-personuppgifter/

    E-mailing Uppsala University means that we will process your
    personal data. For more information on how this is performed,
    please read here: http://www.uu.se/en/about-uu/data-protection-policy
    _______________________________________________
    Geoserver-users mailing list

    Please make sure you read the following two resources before
    posting to this list:
    - Earning your support instead of buying it, but Ian Turton:
    http://www.ianturton.com/talks/foss4g.html#/
    - The GeoServer user list posting guidelines:
    http://geoserver.org/comm/userlist-guidelines.html

    If you want to request a feature or an improvement, also see this:
    
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


    Geoserver-users@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Henning Lorenz
The Swedish Scientific Drilling Program (www.ssdp.se), scientific coordinator
EPOS-Sweden (Swedish participation in EPOS-ERIC;www.epos-se.se), infrastructure 
manager
Uppsala University
Department of Earth Sciences
Villavägen 16
752 36 Uppsala
Sweden
mobile: +46 (0) 701 679 320
e-mail:henning.lor...@geo.uu.se
GnuPG-key:
http://pgp.mit.edu:11371/pks/lookup?search=0x484D3AF03B32FD38&op=index
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to