-
Notifications
You must be signed in to change notification settings - Fork 53
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
CDB_UserDataSize is not safe, might raise error #108
Comments
maybe removing the CTE and doing it as a subquery? |
Adds new _CDB_total_relation_size function that handles nonexistent tables and does fallback to size=0. That function could be used to cache total relation size or query another table view with a cached total relation size. Fixes #108
Huh, well color me surprised. The docs seem to indicate that all parts of a CTE work on independent contexts...
I wonder if the system tables are not managed quite as strictly as the data table WRT to snapshots in MVCC. So, seems like a legitimate problem, and testing ahead of time is reasonable, or wrapping the call to |
Thanks a lot @pramsey! Considering that information and having in mind your comment about functions' transactions I guess it's enough to use the extra function with the Or I'm missing something and we still need to wrap it with an exception block? |
I think the |
It might raise
ERROR: relation "*" does not exist
.pg_total_relation_size
might run against an nonexistent relation the table list is previously populated in a CTE and between list generation and consumption it's possible some of the relations get deleted.A safer version is required, handling the nonexistent relation case.
I've created a simpler snippet so the scenario is easier to reproduce:
p.s. just by removing the
dropping_table
in the last line from theFROM
clause it will work as, I guess, the query planner knows it doesn't need to execute that CTE.The text was updated successfully, but these errors were encountered: