-
Notifications
You must be signed in to change notification settings - Fork 169
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
Two sequences for sec_permission table #2352
Comments
Found the same thing! When I was going through he performance optimization PR, I was looking where permissions were created (sec_permission) and noticed that there's 2 sequences (this is found in my pgAdmin for my local env):
(These are the two that you pionted out above). Where'd they come from? To find out, I looked at postgres migration scripts and searched for each:
I'm not sure why the latter introduced a new sequence, but probably a developer error where they didn't see it. But the It's unfortunate about that because the naming convention that is used isn't the one we would want: the sequence name should be {table}_sequence (or _seq is also used). I think the fix here is to introduce a migration that will drop the un-used sequence. |
@chrisknoll @m0nhawk the migration to fix this could be something like: SELECT setval('sec_permission_sequence', (select max(id)+1 from sec_permission), false);
DROP SEQUENCE ohdsi.sec_permission_seq; |
Right, but dropping |
I noticed something strange in the DB definitions:
In here there is a table definition (I am using Postgres):
But, around the code I see a lot of INSERT statements for other sequence for this table from here, e.g.:
Is there any reason there are two sequences for the same thing?
The text was updated successfully, but these errors were encountered: