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<mailto: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<mailto:gabriel.rol...@gmail.com>>
Lähetetty: keskiviikko 14. helmikuuta 2024 17.46
Vastaanottaja: Jody Garnett 
<jody.garn...@gmail.com<mailto:jody.garn...@gmail.com>>
Kopio: 
geoserver-users@lists.sourceforge.net<mailto: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<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<mailto: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<mailto: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
--
camptocamp
Cécile Vuilleumier
Geospatial developer
www.camptocamp.com<http://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<mailto: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<mailto: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<mailto: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

Reply via email to