-
Notifications
You must be signed in to change notification settings - Fork 79
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
[columnar] fix create table as parallelism bug #138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, parsing the query string is certainly not ideal.
I believe this bug can occur on a insert into ... select
statement as well - though not documented in #50, that may be a more common issue than create table ... as select
.
unfortunately, I've found no other path to fixing this. if it also fails on an as I noted, I'm happy to fix this in a correct way if ever there is a correct way, but as of now, there doesn't appear to be a way to connect them, as even getting the until someone comes forward with a solution that I've not found (I've combed through postgres code repeatedly), I'm not convinced there's another solution. that said, if you can create a test case that still fails with this patch, I'm happy to include it, at least until we can toss this code out with a better solution. |
fe3a10c
to
c5630b3
Compare
adding that it does not fail on insert, nothing to do with these code changes. |
This issue related to |
agreed that the problem should be addressed around |
c5630b3
to
6aef953
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until such time as a better solution present itself, I'm OK with shipping this; we can always change it later.
6aef953
to
6e10beb
Compare
This fixes #50.
This is not the solution that I wanted to write, but it is a solution and it works.
Access to a hook that gives us the plan for the
CREATE TABLE
portion of aCREATE TABLE foo AS
statement is available in the utility hook, but that hook is fired after the table is created and the insert is finished. A planner hook has access to theSELECT
statement, but does not show theCREATE TABLE
portion of the plan.I searched for an alternate method of getting access at the correct time to mutate the plan, but after posting on the postgres slack, discord, and pgsql-hackers mailing list, there was not an answer. If that somehow changes in the future, I will happily revert this for a much better solution.
For now, this is what it does:
CMD_SELECT
it creates a lowercase copy of the query stringcreate
,table
, andas
in that orderit is possible to trigger this with a query like:
SELECT "create", "table", "as", FROM foo
or some other permutation of this, but the likelihood of collision is fairly low.as noted, it's not a perfect fix, but it at least fixes the issue.