-
Notifications
You must be signed in to change notification settings - Fork 898
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
Fix bug in get_general_index_definition function #17
Conversation
* Fixed bug in "table_oid::TEXT" section of the "TABLE_NAME" code. Executing `SELECT create_hypertable('my_table', 'time');` failed with `ERROR: Cannot process index with definition (no index name match)...`. * Replaced "=" with the preferred ":=" assignment operator. Both are allowed, but the latter is less likely to cause subtle bugs due to equality vs assignment (I've run into it before). * Qualified system relations with pg_catalog schema so there is no ambiguity. * Dropped the "CREATE" keyword from the "replace()" function because it was failing to cover the case where an index had a definition like "CREATE UNIQUE INDEX". * Updated some comments. * Revised variable names to have a "v_" prefix to reduce the chance of a name collision between objects in a function (I've hit this in production before).
Thanks for the PR. We're in the process of getting ourselves ready to accept external contributions (e.g., putting together a style guide). Should have that ready soon. Also, noticed that the tests are failing. Think you need to change the expected test result to work with your changes? |
I did see the failed tests but I can't see how they relate to my changes to a plpgsql function. You'll notice the failing command is 'The command "make -f docker.mk test" exited with 2.' |
Our internal tests are passing. If you notice
That means the regression (golden file) tests are no longer passing (probably because the output changed in some small way). We'll work on making this more clear. But in the meantime, you can follow the instruction in the "Testing" section of the README to reproduce the same results locally. Then, your new regression test output will be in test/results and you can copy over the changes to test/expected and commit the changes to the files in test/expected. Note, that this sort of regression file testing is standard and recommended in Postgres. |
Hi, I must be doing something wrong. A fresh git clone and "make installcheck" results in all the tests failing. Can you see if I'm missing a step here?
|
So on a freshly spun up VM, with a clean git pull + make + make install + make installcheck (after making pg_hba.conf and postgresql.conf changes), still results in half the tests failing.
|
That's strange, I just tested and everything passes for me on a clean clone. Can you send the test/regression.diffs file after the run? |
I am sorry this has been so much trouble. I really appreciate you working with us. Apparently, we are missing some instructions/are unfamiliar with the way you are running this. I did find one problem:
But I don't think that solves all the problems. I am having some trouble reproducing this. Can you run
Also it would be very helpful if you could let us know more about your environment/ways to reproduce. How are you running the VM? How are you installing Postgres? Just to make sure: this is running the master branch without your modifications, correct? Again, really appreciate this. Mat |
The make install and make installcheck were run as root so I'm not sure why a permission problem is happening, unless there is a
Installed PostgreSQL from package from https://yum.postgresql.org using Puppet (we have about 2000 VM's running Postgres so there should be nothing unusual about these few instances). CentOS version:
|
I just ran centos:7 in docker. In one terminal I issued the following commands:
In another terminal I ran:
And got the following output:
Can you spot any differences with your setup? Thanks again, |
(Sorry for the delay, I was away camping). I ran the commands you listed and got the following failures:
In our rig, Puppet has already installed Postgres and the associated config files, so there could be some differences in that area, but none that I can think of that would cause failures. The only changes I've made to my conf files are the
I am using a |
So I am confused in your log you have
Which is the correct output. However your diff had:
Which seemed to imply that Is there any way you can send me your Also the output of Thanks and sorry for the hassle. |
HI Mat, absolutely no need to apologize. I'm happy to help if I can, and I realize this debugging is taking time away from your other work. It is entirely possible that the problem is on my end, or the steps I'm running (and which user they run as). alternate_users.out: Non-standard postgresql.conf settings: alternate_users.sql: |
Ok I isolated the problem. It is the cpu_tuple_cost=0.6 setting causing rows to be returned in a slightly different order. We will work on making our regression tests more robust to such settings (just filed an issue #21 ), but in the mean time if you just change this setting back to default it should work. Thanks again for working with us, |
Yep, all tests pass now that that settings is back to default. |
Great. So would it be easy to update this PR with the changes needed to make the tests pass? |
Is there a way to force the existing batch of changes to get retested without having to make other changes? I can't understand why the tests failed in the first place, since I didn't touch any configs (including the cpu_tuple_cost setting). |
I just restarted the build with the same results. I'll take a closer look tonight/tomorrow morning. The best way to test a PR is to check it out locally (https://help.github.com/articles/checking-out-pull-requests-locally/) and run make installcheck on the pr exactly as it is. |
Thanks, I'll try to test again today if I can scrape up a small window of time. |
Okay, I have a revised function that works, passes tests, and handles mixed-case identifiers properly (table, index, and column names) and indexes that have more than then bare "INDEX" keyword (eg. UNIQUE INDEX). |
SELECT create_hypertable('my_table', 'time');
failed withERROR: Cannot process index with definition (no index name match)...
.