Here are the steps you can take to rectify the issue of a corrupted geometry column caused by altering the Postgis Schema Name in QGIS:
Connect to your PostGIS database using a SQL client, such as pgAdmin or psql.
Create a backup of your database in case anything goes wrong during the following steps.
Run the following SQL script to update the schema name of your spatial tables:
ALTER TABLE <schema_name>.<table_name> SET SCHEMA <new_schema_name>;
Run the following SQL script to update the SRID of your spatial tables:
SELECT UpdateGeometrySRID('<new_schema_name>', '<table_name>', 'geom', <new_srid>);
Replace <new_srid> with the SRID that you want to use for your geometry column.
If you have any views that reference your spatial tables, update their definitions to use the new schema name:
CREATE OR REPLACE VIEW <new_schema_name>.<view_name> AS
SELECT <columns>
FROM <new_schema_name>.<table_name>
WHERE <condition>;
Replace <columns> with the columns that you want to select and <condition> with the condition that you want to use to filter the rows.
Finally, re-add the spatial tables to QGIS and verify that the geometry column is now working correctly.
If you are not comfortable performing these steps yourself, it may be best to seek the assistance of a qualified database administrator or GIS professional.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-01-08 11:00:00 +0000
Seen: 10 times
Last updated: Jul 28 '21
What is the method for programmatic access to a time series?
What is the procedure for using pg_restore on Windows with Docker?
Can SqlDependency be used in a programming language other than .NET, such as node js?
How can multiple queries be merged into a single stored procedure in MySQL?
How can I deal with Expression.Error related to a column in Power Query?
How can you implement pagination in Oracle for the LISTAGG() function?
What is the process for implementing a FutureBuilder on an OnTap function in Flutter?