[GIS] Rename postGIS table and updating the GeoServer

geoserverpostgispostgresql

I want to rename one of my postGIS tables. However, when I do this by applying a simple

ALTER TABLE old_name RENAME TO new_name;

The spatial data, as I understand it, isn't updated with the new name. First, can these references be fixed by running the function:

SELECT probe_geometry_columns()

Is the table itself OK after this? Or should other measures be taken also?
Second, how do I update GeoServer so that it finds this new table? As of now, if I run the above commands, and edit the layer info on the GeoServer to point to the new name… I still get an error (GeoServer still tries to find it under the old name). Exactly, where should the layer name be changed on the GeoServer?

Best Answer

Note that in PostGIS 2.0+, all you have to do is the normal

ALTER TABLE old_name RENAME TO new_name;

The entry in the geometry_columns view (or geography_columns) will also be updated.

Related Question