tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
381 stars 102 forks source link

Error on Update statements #80

Closed isapir closed 8 years ago

isapir commented 8 years ago

Hi,

Are Update statements supported? I am getting errors on INSERT, UPDATE, and DELETE.

postgres=# INSERT INTO mssql_test1 (id, name) VALUES (2, 'Postgres FDW');
ERROR:  cannot insert into foreign table "mssql_test1"

postgres=# DELETE FROM mssql_test1;
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed database context to 'TESTDB'., Server: SERVER, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5703, Msg state: 1, Msg: Changed language setting to us_english., Server: SERVER, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 1003, Msg state: 2, Msg: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR., Server: SERVER, Process: , Line: 1, Level: 15
ERROR:  DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: (null), Level: 15

postgres=# UPDATE mssql_test1 SET name='FDW';
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed database context to 'TESTDB'., Server: SERVER, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5703, Msg state: 1, Msg: Changed language setting to us_english., Server: SERVER, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 1003, Msg state: 2, Msg: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR., Server: SERVER, Process: , Line: 1, Level: 15
ERROR:  DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: (null), Level: 15
isapir commented 8 years ago

p.s. Obviously SELECT works properly on that same FDW:

postgres=# SELECT * FROM mssql_test1;
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed database context to 'TESTDB'., Server: SERVER, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5703, Msg state: 1, Msg: Changed language setting to us_english., Server: SERVER, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed database context to 'TESTDB'., Server: SERVER, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5703, Msg state: 1, Msg: Changed language setting to us_english., Server: SERVER, Process: , Line: 1, Level: 0
 id | name
----+------
  1 | Test
  1 | Test
(2 rows)
GeoffMontee commented 8 years ago

Insert, update, and delete statements are not currently supported. Those are all included in feature request #9.

isapir commented 8 years ago

OK, Thank you.

Closing as duplicate of issue #9 then