You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After creating foreign table and executing select * from my_foreign_table limit 1 getting error "Remote server returned an error". This happens if foreign table is pointed to the RDBS which doesn't support LIMIT clause for SELECT. For example, Oracle.
The reason, is because LIMIT clause is passed into the remote server as is. And if remote engine doesn't support such syntax - it results into an error.
For Oracle as a target
explain verbose
select id from my_foreign_table limit 1;
-- output
Foreign Scan on public.my_foreign_table o (cost=1.00..1.00 rows=1 width=516)
Output: id
Remote SQL: SELECT id FROM my_foreign_table LIMIT 1
Here LIMIT 1 was passed directly to the oracle side. For fix, it's required to cast somehow LIMIT N to the WHERE ROWNUM <= N. Because obviously, you couldn't execute select id from my_foreign_table where rownum <= 1 on postgres side.
After creating foreign table and executing
select * from my_foreign_table limit 1
getting error "Remote server returned an error". This happens if foreign table is pointed to the RDBS which doesn't supportLIMIT
clause forSELECT
. For example, Oracle.The reason, is because
LIMIT
clause is passed into the remote server as is. And if remote engine doesn't support such syntax - it results into an error.For Oracle as a target
Here
LIMIT 1
was passed directly to the oracle side. For fix, it's required to cast somehowLIMIT N
to theWHERE ROWNUM <= N
. Because obviously, you couldn't executeselect id from my_foreign_table where rownum <= 1
on postgres side.For quick check there is postgres docker image with
jdbc_fdw
installed: https://hub.docker.com/r/chumaky/postgres_jdbc_fdwThe text was updated successfully, but these errors were encountered: