-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[YSQL] "ERROR: Declare Cursor Variable not supported yet" stops me implementing my use-case #3286
Labels
area/ysql
Yugabyte SQL (YSQL)
roadmap-tracking-issue
This issue tracks a major roadmap item, and usually appears in the roadmap list.
Projects
Comments
hi @ddorian , i also got an Error
|
Do you have plans to implement cursor support? I think it would also allow to use postgres_fdw to connect to yugabytedb from regular postgres. |
@xvaara -- Cursor support's implementation is nearing completion (in the final leg of code reviews/testing). |
nocaway
added a commit
that referenced
this issue
Dec 23, 2020
Summary: CURSOR feature is turned ON with the following notes. (1) Fixed a couple of crashes in "src/postgres/contrib/yb_pg_metrics/yb_pg_metrics.c" This module uses global variables to control the states of a PORTAL execution. This design is very flawed, and this work needs a redo. For now, workaround is added. - Introduced separate state-variables for block and statement initializations. - Used "querydesc" attribute as indicator for logging metrics because global state variables cannot be used when there are nested executions. (2) A number bugs on CURSOR are not fixed at this time due to its complexity. - Issue #6514 - Issue #6541 - Issue #6627 - Issue #6629 Test Plan: Add a few new test suites. More will be added later on. Reviewers: alex, mihnea Reviewed By: mihnea Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D10135
nocaway
added a commit
that referenced
this issue
Jan 12, 2021
Summary: CURSOR feature is turned ON with the following notes. (1) Fixed a couple of crashes in "src/postgres/contrib/yb_pg_metrics/yb_pg_metrics.c" This module uses global variables to control the states of a PORTAL execution. This design is very flawed, and this work needs a redo. For now, workaround is added. - Introduced separate state-variables for block and statement initializations. - Used "querydesc" attribute as indicator for logging metrics because global state variables cannot be used when there are nested executions. (2) A number bugs on CURSOR are not fixed at this time due to its complexity. - Issue #6514 - Issue #6541 - Issue #6627 - Issue #6629 Test Plan: Add a few new test suites. More will be added later on. Reviewers: alex, mihnea Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D10327
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/ysql
Yugabyte SQL (YSQL)
roadmap-tracking-issue
This issue tracks a major roadmap item, and usually appears in the roadmap list.
Using 11.2-YB-2.0.9.0-b0 on Ubuntu 18.04.
This compilation attempt is enough to demonstrate the restriction:
The attempt causes this error:
I've copied the text of my intended function at the end so that you can see why it benefits from dynamic SQL. I developed and tested it in vanilla PG 11.2 where (of course) it works fine.
At least I have a choice of two workarounds:
(1) Use the
list_agg()
built-in in the select list so that the query returns a single result, use the simpleexecute Stmt into result
(which I have shown works) and step through the array of records programmatically. This is, anyway, a generally useful way to implement "bulk collect" (as Oracle Database calls it and for which plpgsql has no corresponding functionality). Only thing is, in YB it performs worse than a straight "cursor for loop" unless the result set is large. (The break-even comes at about 500 rows.) In PG it never harms performance, and the benefit kicks in with much smaller result sets.(2) Define the required number of static cursors and choose the one to open with a case statement. This is no good in general, because not all the facts are at hand until run time. It also suffers from the combinatorial explosion effect, so it's viable (but tedious to program and QA) only when the number of, and cardinality of, the degrees of freedom increases. In my use case it's 2*3 (two tables and three possible ratios).
The real function
The text was updated successfully, but these errors were encountered: