Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update MS SQL Server tables with geometry #257

Open
Davis-Klavins opened this issue Jun 17, 2024 · 5 comments
Open

Unable to update MS SQL Server tables with geometry #257

Davis-Klavins opened this issue Jun 17, 2024 · 5 comments

Comments

@Davis-Klavins
Copy link

Read through similar ticket, but can't get to work updating MS SQL Server 2016 tables that have geometry column. Without it, works fine both with FreeTDS driver on Ubuntu 24.04, PostgreSQL 16 and even ODBC Driver 17 for SQL Server on Centos 7, PostgreSQL 12.

On table created in MS SQL Server with

CREATE TABLE dbo.test (
  ID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY
  ,CODE VARCHAR(14) NOT NULL
  ,x DECIMAL(9, 3) NULL
  ,y DECIMAL(9, 3) NULL
  );

query

UPDATE schema_name.dbo_test
SET x = 1;

in PostgreSQL works fine.

But on table created in MS SQL Server with

CREATE TABLE dbo.test_geom (
  ID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY
  ,CODE VARCHAR(14) NOT NULL
  ,geom geometry NOT NULL
  ,x DECIMAL(9, 3) NULL
  ,y DECIMAL(9, 3) NULL
  );

query

UPDATE schema_name.dbo_test_geom
SET x = 1;

in PostgreSQL returns error:

ERROR:  foreign table "dbo_test_geom" does not allow updates 

SQL state: 55000
@pramsey
Copy link
Owner

pramsey commented Jun 17, 2024

What if you use FID as the name of your PK?

@Davis-Klavins
Copy link
Author

Tested, unfortunately the same.

@pramsey
Copy link
Owner

pramsey commented Jun 17, 2024

Unless you can get a debugger on it and step through, this ticket will probably languish, as I do not have an environment to test against. It's possible if @robe2 can replicate your situation that she could debug it.

@pramsey
Copy link
Owner

pramsey commented Jun 17, 2024

(Actually there is one thing I can do which is verify that update works on a loop-back connection to postgres, but it probably does. What GDAL version do you have, that's another variable that might have changed over time.)

@Davis-Klavins
Copy link
Author

On Ubuntu where OGR FDW was installed via apt (postgresql-16-ogr-fdw), SELECT ogr_fdw_version(); reports GDAL version 3.8.4.
On Centos where it was compiled, respective gdal-config --version reports GDAL version 3.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants