Indeed good points about ease of use.
Still, I'd add to the danger list:
* you can't guarantee the atomicity of the operation
* in general terms it is not the exact reverse of the create feature type
functionality. A single db table may be used by several feature types
across different workspaces even
*  Flag parameters are bad design, increases complexity and understanding,
breaks a couple principles. Worse case scenario it can't be called
`cascade=true`, the workspace delete endpoint already uses it with
different semantics, unless you want to delete all tables which would be
catastrophic IMHO

My compromise solution would then be to have a separate operation to delete
the table:
* keep delete feature type atomic and single purpose.
* the delete table endpoint would be atomic and fail if the table is used
by any feature type. simple.

question arises of how to determine which table to delete once you deleted
the FeatureType. I guess it should be an operation of the DataStore and not
of the FeatureType, and use the FeatureType's nativeName to distinguish?

2c.
Gabe


On Thu, 15 Feb 2024 at 08:01, Simone Giannecchini <
simone.giannecch...@geosolutionsgroup.com> wrote:

> I like Andrea's take but Gabriel made a very good point.
> I agree with Gabriel that certain tasks should stay outside GeoServer but
> reality is that we have a number of users which have very small
> infrastructures and they cannot afford having pipelines to perform some
> tasks outside of it and they simply expect GeoServer to do such tasks for
> them.
> I'd say that whenever possible and not difficult to maintain we should try
> to give them tools to ease their work (and simplify GeoServer adoption).
>
> Regards,
> Simone Giannecchini
> ==
> Online training classes for GeoNode, GeoServer and MapStore from the
> experts!
> Visit https://www.geosolutionsgroup.com/professional-training/ for more
> information.
> ==
> Ing. Simone Giannecchini
> @simogeo
> Founder/Director GeoSolutions Italy
> President GeoSolutions USA
>
> phone: +39 0584 962313
> fax:     +39 0584 1660272
> mob:   +39  333 8128928
> US: +1 (845) 547-7905
>
> http://www.geosolutionsgroup.com
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
> 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, Feb 15, 2024 at 11:01 AM Andrea Aime <
> andrea.a...@geosolutionsgroup.com> wrote:
>
>> Hi all,
>> the typical GeoServer approach is not to be opinionated about things.
>> "Proudly letting users free since 2002" could be our slogan... want to be
>> strictly OGC compliant? We have a checkbox for you.
>> Want to do things in a more convenient way and the hell with standard
>> strictness? We also support that.
>>
>> Table creation is already allowed both by the importer (which also
>> imports the data), and by the GUI/REST API
>> <https://github.com/geoserver/geoserver/blob/0ab715486a958632e9e7d54ad5746a4858189f3b/src/restconfig/src/main/java/org/geoserver/rest/catalog/FeatureTypeController.java#L226>
>> for table creation
>> (WFS-T should then be used for data import):
>>
>> [image: image.png]
>>
>> [image: image.png]
>>
>> Having a delete would make things symmetric, and I agree that cascade
>> should be explicitly added for that
>> to happen.
>>
>> That said, I also hear the voice of those claiming "geoserver should not
>> be used to manage data".
>> For that, we should have a simple warning in the production section:
>> "GeoServer offers ability to create
>> and drop tables through UI and REST API, if this is not your intent,
>> please lock down the database
>> grants for the account used by GeoServer"... which is generally speaking
>> also good IT hygiene in general.
>> (don't give accounts more rights than necessary).
>>
>> Cheers
>> Andrea
>>
>>
>> On Thu, Feb 15, 2024 at 9:29 AM Rahkonen Jukka <
>> jukka.rahko...@maanmittauslaitos.fi> wrote:
>>
>>> Hi,
>>>
>>>
>>>
>>> I do not believe that it is generally possible to know if the table was
>>> created with REST API or by some other means. It is possible to check the
>>> owner of the table and if Geoserver is configured to use a special database
>>> account with well thought-out privileges it might be safe to allow to drop
>>> tables with REST. However, I believe that in most Geoserver installations
>>> the geoserver db user has all too wide privileges, at least if you ask from
>>> the DB admins.
>>> If we will have a configuration option "cascade=true" then it should be
>>> off by default, and somehow the geoserver admin who turns it on should be
>>> made aware of all the consequences.
>>>
>>>
>>>
>>> -Jukka Rahkonen-
>>>
>>>
>>>
>>>
>>>
>>> *Lähettäjä:* Roar Brænden <roar.brenden...@gmail.com>
>>> *Lähetetty:* keskiviikko 14. helmikuuta 2024 23.29
>>> *Vastaanottaja:* geoserver-users@lists.sourceforge.net
>>> *Kopio:* Gabriel Roldan <gabriel.rol...@gmail.com>; Jody Garnett <
>>> jody.garn...@gmail.com>; Rahkonen Jukka <
>>> jukka.rahko...@maanmittauslaitos.fi>
>>> *Aihe:* Re: [Geoserver-users] Deleting database table through REST API
>>>
>>>
>>>
>>> Hi,
>>>
>>>
>>>
>>> I think it would be helpful to separate the use cases. The original
>>> question was about a database table that were created by the REST API when
>>> creating a layer. In such a situation it makes sense to delete the table
>>> when deleting the layer. Otherwise you could see a scenario were there are
>>> a lot of lost tables in the database.
>>>
>>>
>>>
>>> In other situations we have a layer that is wrapped on top of an
>>> existing table. In such cases it would be very disruptive to delete the
>>> database table when deleting the layer.
>>>
>>>
>>>
>>> I'm in favor of introducing an extra parameter for instance
>>> "cascade=true", if the user wants to delete the database table as well. In
>>> the last scenario it would also make sense to restrict the database user,
>>> that are configured in Geoserver, from making disruptive calls to the
>>> database. Like dropping a table.
>>>
>>>
>>>
>>> Regards,
>>>
>>> Roar Brænden
>>>
>>>
>>>
>>>
>>>
>>> 14. feb. 2024 kl. 17:42 skrev Rahkonen Jukka <
>>> jukka.rahko...@maanmittauslaitos.fi>:
>>>
>>>
>>>
>>> Hi,
>>>
>>>
>>>
>>> I was thinking about the same, but if user can do something with the
>>> user interface then why not with REST? Both are secured only by the
>>> username/password.  However, I do not know if it is possible to drop
>>> database tables from the UI. I have seen some user requests about cascading
>>> deletes so that deleting a layer would also delete the data. I think that
>>> is not a good idea.
>>>
>>>
>>>
>>> -Jukka Rahkonen-
>>>
>>>
>>>
>>> *Lähettäjä:* Gabriel Roldan <gabriel.rol...@gmail.com>
>>> *Lähetetty:* keskiviikko 14. helmikuuta 2024 17.46
>>> *Vastaanottaja:* Jody Garnett <jody.garn...@gmail.com>
>>> *Kopio:* geoserver-users@lists.sourceforge.net
>>> *Aihe:* Re: [Geoserver-users] Deleting database table through REST API
>>>
>>>
>>>
>>> Hi all,
>>>
>>> For the record,
>>>
>>> I'm utterly against deleting database tables through the geoserver REST
>>> API
>>>
>>> * It's absolutely dangerous
>>>
>>> * The REST API shall with GeoServer "resources", not infrastructure ones
>>>
>>>
>>>
>>> If I wanted to delete a table through *a* REST API, I'd better run two
>>> queries, one to delete the geoserver FeatureType/Layer,
>>>
>>> and another one to delete the database table, for which there are
>>> existing solutions, for example PostgREST https://postgrest.org
>>>
>>> (not sure if that one lets you drop tables) but you get the idea.
>>>
>>>
>>>
>>> Cheers,
>>>
>>> Gabe
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, 12 Feb 2024 at 16:25, Jody Garnett <jody.garn...@gmail.com>
>>> wrote:
>>>
>>> I am open to improvements and addition to the importer API (which offers
>>> some control as it is responsible for the automatic creation of tables; it
>>> has an opportunity to delete an existing table when replacing contents).
>>>
>>>
>>>
>>> See example
>>> https://docs.geoserver.org/latest/en/user/extensions/importer/rest_examples.html#replacing-postgis-table-using-the-contents-of-a-csv-file
>>>
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Jody Garnett
>>>
>>>
>>>
>>>
>>>
>>> On Feb 12, 2024 at 1:30:11 AM, Cécile Vuilleumier <
>>> cecile.vuilleum...@camptocamp.com> wrote:
>>>
>>> Hi all
>>> When creating a feature type in a database datastore with the REST API,
>>> GeoServer will create the corresponding table if it does not exist.
>>> We were wondering if similarly the deletion of a table was also possible
>>> when deleting the associated feature type and I found this discussion:
>>> https://sourceforge.net/p/geoserver/mailman/message/36221224/
>>> Does anybody know if a proposal had been submitted? I couldn't find it
>>> on the GitHub wiki but I might have missed it.
>>> Many thanks, Cécile
>>>
>>> --
>>> *camp**to**camp*
>>>
>>> *Cécile Vuilleumier*
>>>
>>> Geospatial developer
>>> www.camptocamp.com
>>>
>>> _______________________________________________
>>> 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
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Gabriel Roldán
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>>
>> --
>>
>> Regards,
>>
>> Andrea Aime
>>
>> ==
>> GeoServer Professional Services from the experts!
>>
>> Visit http://bit.ly/gs-services-us for more information.
>> ==
>>
>> Ing. Andrea Aime
>> @geowolf
>> Technical Lead
>>
>> GeoSolutions Group
>> phone: +39 0584 962313
>>
>> fax:     +39 0584 1660272
>>
>> mob:   +39  339 8844549
>>
>> https://www.geosolutionsgroup.com/
>>
>> 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
>> _______________________________________________
>> 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
>>
> _______________________________________________
> 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
>


-- 
Gabriel Roldán
_______________________________________________
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