![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have two database. One database has proxy table from second database. Select from proxy table work fine. First command is "insert into main_table select * from proxy_table" and it works fine. Second command is test for new options for INSERT command, ON EXISTING ... "insert into main_table ON EXISTING SKIP select * from proxy_table" works fine (skip) "insert into main_table ON EXISTING UPDATE select * from proxy_table" returns error : << update operation attempted on non-updatable remote query >> Hmm, i don't update remote (proxy) table, i do update local table with data from proxy table .... BUG ? |
#3
| |||
| |||
|
|
You cannot insert values into a proxy table with the ON EXISTING clause. Please see the documentation: http://dcx.sybase.com/1101en/dbrefer...statement.html SQL Anywhere Developer Community: http://www.sybase.com/developer/libr...ere-techcorner SQL Anywhere Blog Center: http://www.sybase.com/sqlanyblogs Bofcilo wrote: I have two database. One database has proxy table from second database. Select from proxy table work fine. First command is "insert into main_table select * from proxy_table" and it works fine. Second command is test for new options for INSERT command, ON EXISTING ... "insert into main_table ON EXISTING SKIP select * from proxy_table" works fine (skip) "insert into main_table ON EXISTING UPDATE select * from proxy_table" returns error : << update operation attempted on non-updatable remote query >> Hmm, i don't update remote (proxy) table, i do update local table with data from proxy table .... BUG ? |
#4
| |||
| |||
|
|
I have two database. One database has proxy table from second database. Select from proxy table work fine. First command is "insert into main_table select * from proxy_table" and it works fine. Second command is test for new options for INSERT command, ON EXISTING ... "insert into main_table ON EXISTING SKIP select * from proxy_table" works fine (skip) "insert into main_table ON EXISTING UPDATE select * from proxy_table" returns error : << update operation attempted on non-updatable remote query >> Hmm, i don't update remote (proxy) table, i do update local table with data from proxy table .... BUG ? |
#5
| |||
| |||
|
|
This is a very irritating limitation of remote servers, and it persists through to version 11.0.1 (I just confirmed that with the code below). Could not execute statement. Remote server does not have the ability to support this statement SQLCODE=-706, ODBC 3 State="HY000" Line 43, column 1 You can continue executing or stop. INSERT t2 ON EXISTING UPDATE SELECT * FROM proxy_t1 Personally, I'd call it a "bug" since the proxy table is just providing the data to the INSERT statement, and after the main database receives the data it can do the ON EXISTING UPDATE logic without any participation on the part of the remote server process. Let's just say this has bugged me for years (pun intended). Breck --------------------------------------------------------------------- -- Run this on ddd1 BEGIN DROP TABLE t1; EXCEPTION WHEN OTHERS THEN END; CREATE TABLE t1 ( pkey INTEGER NOT NULL PRIMARY KEY, col1 INTEGER NOT NULL ); INSERT t1 VALUES ( 1, 1 ); INSERT t1 VALUES ( 3, 1 ); INSERT t1 VALUES ( 5, 1 ); COMMIT; --------------------------------------------------------------------- -- Run this on ddd2 BEGIN DROP TABLE t2; EXCEPTION WHEN OTHERS THEN END; CREATE TABLE t2 ( pkey INTEGER NOT NULL PRIMARY KEY, col1 INTEGER NOT NULL ); INSERT t2 VALUES ( 2, 2 ); INSERT t2 VALUES ( 4, 2 ); INSERT t2 VALUES ( 6, 2 ); COMMIT; BEGIN DROP TABLE proxy_t1; EXCEPTION WHEN OTHERS THEN END; BEGIN DROP EXTERNLOGIN DBA TO ddd1; EXCEPTION WHEN OTHERS THEN END; BEGIN DROP SERVER ddd1; EXCEPTION WHEN OTHERS THEN END; CREATE SERVER ddd1 CLASS 'SAODBC' USING 'DRIVER=SQL Anywhere 11;ENG=ddd1;DBN=ddd1'; CREATE EXTERNLOGIN DBA TO ddd1 REMOTE LOGIN dba IDENTIFIED BY 'sql'; -- The AT owner is optional... -- Will fail if table not found... CREATE EXISTING TABLE proxy_t1 AT 'ddd1..DBA.t1'; INSERT t2 ON EXISTING UPDATE SELECT * FROM proxy_t1; COMMIT; SELECT * FROM t2 ORDER BY pkey; On Mon, 16 Nov 2009 06:58:08 -0800 (PST), Bofcilo <sprintrz (AT) gmail (DOT) com wrote: I have two database. One database has proxy table from second database. Select from proxy table work fine. First command is "insert into main_table select * from proxy_table" and it works fine. Second command is test for new options for INSERT command, ON EXISTING ... "insert into main_table ON EXISTING SKIP select * from proxy_table" works fine (skip) "insert into main_table ON EXISTING UPDATE select * from proxy_table" returns error : << update operation attempted on non-updatable remote query >> Hmm, i don't update remote (proxy) table, i do update local table with data from proxy table .... BUG ? -- Breck Carter - Blog: http://sqlanywhere.blogspot.com/ SQLA questions and answers: http://sqla.stackexchange.com RisingRoad helps SQL Anywhere developers make better databases http://www.risingroad.com/ Breck.Carter at gmail |
#6
| |||
| |||
|
|
"insert into main_table ON EXISTING UPDATE select * from proxy_table" returns error : << update operation attempted on non-updatable remote query >> Hmm, i don't update remote (proxy) table, i do update local table with data from proxy table .... |
#7
| |||
| |||
|
|
"insert into main_table ON EXISTING UPDATE select * from proxy_table" returns error : << update operation attempted on non-updatable remote query >> Hmm, i don't update remote (proxy) table, i do update local table with data from proxy table .... if you want to go safe, proxy tables should be used only to select data into temp tables from them, using simple a where clausa, and nothing else. you can't even trust order by. nor joins. for example, if you use join, and the proxy table has an index, it might be used to carry out the join, even if the collation does not match to the local db. proxy tables are inherently evil. |
#8
| |||
| |||
|
|
Can you provide a simple reproducible? I am 100% sure that the engineers at iAnywhere will be interested in it. |
#9
| |||
| |||
|
|
You cannot insert values into a proxy table with the ON EXISTING clause. Please see the documentation: * * * *http://dcx.sybase.com/1101en/dbrefer...statement.html SQL Anywhere Developer Community:http://www.sybase.com/developer/libr...ere-techcorner SQL Anywhere Blog Center:http://www.sybase.com/sqlanyblogs OK, Breck reply to you. I'm not inserting on proxy table. Proxy is on |
#10
| |||
| |||
|
|
This is a very irritating limitation of remote servers, and it persists through to version 11.0.1 (I just confirmed that with the code below). Could not execute statement. Remote server does not have the ability to support this statement SQLCODE=-706, ODBC 3 State="HY000" Line 43, column 1 You can continue executing or stop. INSERT t2 ON EXISTING UPDATE SELECT * FROM proxy_t1 Personally, I'd call it a "bug" since the proxy table is just providing the data to the INSERT statement, and after the main database receives the data it can do the ON EXISTING UPDATE logic without any participation on the part of the remote server process. Let's just say this has bugged me for years (pun intended). Breck --------------------------------------------------------------------- -- Run this on ddd1 BEGIN * *DROP TABLE t1; * *EXCEPTION WHEN OTHERS THEN END; CREATE TABLE t1 ( * *pkey *INTEGER NOT NULL PRIMARY KEY, * *col1 *INTEGER NOT NULL ); INSERT t1 VALUES ( 1, 1 ); INSERT t1 VALUES ( 3, 1 ); INSERT t1 VALUES ( 5, 1 ); COMMIT; --------------------------------------------------------------------- -- Run this on ddd2 BEGIN * *DROP TABLE t2; * *EXCEPTION WHEN OTHERS THEN END; CREATE TABLE t2 ( * *pkey *INTEGER NOT NULL PRIMARY KEY, * *col1 *INTEGER NOT NULL ); INSERT t2 VALUES ( 2, 2 ); INSERT t2 VALUES ( 4, 2 ); INSERT t2 VALUES ( 6, 2 ); COMMIT; BEGIN * *DROP TABLE proxy_t1; * *EXCEPTION WHEN OTHERS THEN END; BEGIN * *DROP EXTERNLOGIN DBA TO ddd1; * *EXCEPTION WHEN OTHERS THEN END; BEGIN * *DROP SERVER ddd1; * *EXCEPTION WHEN OTHERS THEN END; CREATE SERVER ddd1 CLASS 'SAODBC' * *USING 'DRIVER=SQL Anywhere 11;ENG=ddd1;DBN=ddd1'; CREATE EXTERNLOGIN DBA TO ddd1 REMOTE LOGIN dba IDENTIFIED BY 'sql'; -- The AT owner is optional... -- Will fail if table not found... CREATE EXISTING TABLE proxy_t1 AT 'ddd1..DBA.t1'; INSERT t2 ON EXISTING UPDATE SELECT * FROM proxy_t1; COMMIT; SELECT * FROM t2 ORDER BY pkey; On Mon, 16 Nov 2009 06:58:08 -0800 (PST), Bofcilo <sprin... (AT) gmail (DOT) com wrote: I have two database. One database has proxy table from second database. Select from proxy table work fine. First command is *"insert into main_table select * from proxy_table" and it works fine. Second command is test for new options for INSERT command, ON EXISTING ... "insert into main_table ON EXISTING SKIP select * from proxy_table" works fine (skip) "insert into main_table ON EXISTING UPDATE select * from proxy_table" returns error : << update operation attempted on non-updatable remote query >> Hmm, i don't update remote (proxy) table, i do update local table with data from proxy table .... BUG ? -- Breck Carter - Blog:http://sqlanywhere.blogspot.com/ SQLA questions and answers:http://sqla.stackexchange.com RisingRoad helps SQL Anywhere developers make better databaseshttp://www.risingroad.com/ Breck.Carter at gmail |
.![]() |
| Thread Tools | |
| Display Modes | |
| |