-
Notifications
You must be signed in to change notification settings - Fork 15
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
Query string truncation/off by one error when explaining some queries? #17
Comments
That's strange. I haven't been able to reproduce this. It could be a 9.1 specific issue. |
On 29 January 2013 22:27, Peter Geoghegan [email protected] wrote:
Simon Riggs http://www.2ndQuadrant.com/ |
We're also suffering from this. Any ideas for a workaround? |
What version of Postgres are you using, Msch? |
@terrorobe @MSch Did either of you see this again? I can't help but suspect that it might have had something to do with the fact that this query contains SQL functions, which were recently shown to be a problematic case for pg_stat_plans due to planner pre-processing invoking the executor multiple times for the same client supplied query - all at the same "level". But I've never been able to recreate the problem, and I still can't figure it out in light of what we now know about that case. What I think this might be down to is the fact that pg_stat_plans_explain() doesn't do an encoding conversion, which it really should. However, the fact that the hash key includes the encoding id is really just a notational convenience. As both pg_stat_plans and pg_stat_statements say:
I cannot think of a scenario in which this should matter - the sourceText that we get from the core system should always be of the encoding returned by GetDatabaseEncoding(), so pg_stat_statements (and by extension pg_stat_plans) isn't really obligated to care about encoding at all. And even if it did matter, I'm having a hard time imaging why we wouldn't get away with it in this case. However, despite all this, I will draft a patch to make pg_stat_plans do an encoding conversion when generating an EXPLAIN string. It makes sense from a maintainability perspective - as long as pg_stat_plans() (the function) is doing this, there ought to be parity within pg_stat_plans_explain(). |
I just checked our database. For ~3.6 million collected plan snapshots we've got about 350.000 which caused errors.
The one query that caused the "syntax error at end of input" is a query which looks like if it got truncated at plans_query_size:
The original database using the earthbox queries isn't in there anymore so I guess that was probably the culprit after all. I'd say we close this bug for now - if it should resurface I'll reopen it again. |
I've noticed these errors in a production environment which seem rather odd given the fact that the user doesn't handle/change the query string anywhere.
So far I haven't been able to reproduce it by hand, will give more input as soon as I've got more.
The text was updated successfully, but these errors were encountered: