SQL Plan greater than 2048 characters is not printed at all in ISQL [CORE2370] #2792
Submitted by: Bill Oliver (verbguy)
Assigned to: Claudio Valderrama C. (robocop)
I have a query plan with unions that is greater than 2048 characters, it is 5764 characters. The result is that in ISQL, I only get a blank line for the plan!
The trivial fix is to bump up the size of the buffer in ISQL's process_plan(). I increased buffer size to 8096, and it worked fine.
Perhaps a better fix is to max out the buffer size in process_plan(), so we don't have to touch this area again. We know that the maximum possible length of the plan is MAX_SSHORT, see dsql.cpp's DSQL_get_plan_info(). Anything longer than this, and the plan will be returned, but it will end in ellipses. That's ok.
I've coded a patch for this issue. In testing, it seems to me that dsql.cpp's put_item() length check is off by one, but I'd like the committer to double-check this.
### Eclipse Workspace Patch 1.0
The text was updated successfully, but these errors were encountered:
Commented by: Claudio Valderrama C. (robocop)
First, put_item() is correct, because it's reserving space for isc_info_end and isc_info_sql_describe_end. Look at the functions that use it. When you are going to finish the string, if you discover there's no room for a single byte, it's too late to put even isc_info_truncated.
Second, I have enlarged the internal interface to take plans of any length in practice (really, up to 2^31-1), but there are some public API calls that I cannot change, so these places appear as constraints with a maximum of 2^16 (USHORT).
Third, the amount of places where temporary buffers are used to retrieve plan information is really daunting, plus several possibilities of internal retries (with bigger buffers). The sole call stack is a mountain. I don't dare to touch that for now, but some day it should be streamlined.