-
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
Cartodbfy error assigning an organization owner #174
Comments
This is the root cause (the query done in the cartodbfy function):
it gets two rows, actually the first one in the variable |
The problem is having two indexes defined on the same \d chehalis_reaches_habitat_hits
-- ...
Indexes:
"chehalis_reaches_habitat_hits_pkey" PRIMARY KEY, btree (cartodb_id)
"chehalis_reaches_habitat_hits_cartodb_id_key" UNIQUE CONSTRAINT, btree (cartodb_id)
-- ... The failing code: https://github.com/CartoDB/cartodb-postgresql/blob/master/scripts-available/CDB_CartodbfyTable.sql#L533-L577 I deleted the second index but it failed with other tables. @pramsey Any suggestion to make it robust to this problem? |
I'm guessing that it's hitting the non-primary key index first, and then trying to create a primary key, which raises an uncaught error. In actuality our test is a bit too strict, at https://github.com/CartoDB/cartodb-postgresql/blob/master/scripts-available/CDB_CartodbfyTable.sql#L550
cloud be
right? If it's either a primary key index or a unique index we'll be OK? I think I need to rework this for the case of a compound primary key, but that's another degree of unlikeliness at the moment. Think that makes sense? |
Putting things in context, this is kind of a corner case which won't affect normal cases. We deleted the extra index manually cause it doesn't make sense to have two I think the change in the
I wouldn't do that, I think we're good with taking existing simple candidate keys if they exist or creating a new one if there's no suitable one. Thanks for the help and prompt response. |
FYI this has happened again. Now, to @micagm , with blockbrief user: https://rollbar.com/vizzuality/CartoDB/items/10418/occurrences/9049351252/ . I'll delete the extra indexes again, but add a vote to a fix for this :-) |
Gonna keep this open until we actually release the new version of the extension |
Version 0.11.4, which fixes this was deployed in production to all user DBs on 2015-11-27. |
@yasharora73 has assigned a user to an organization as owner and it has failed.
This's been the error:
Sequel::DatabaseError: PG::Error: ERROR: CDB(_CDB_Has_Usable_Primary_ID): ALTER TABLE "USERNAME".USER_TABLE ADD CONSTRAINT cartodb_id_pk PRIMARY KEY (cartodb_id) CONTEXT: SQL statement "SELECT _CDB_Error(sql, '_CDB_Has_Usable_Prima
:As a result, none of the tables were moved (since CartoDB/cartodb#5477 table movement is performed in a transaction). Some metadata was kept and fixed manually: CartoDB/cartodb#6006 .
I reported @rafatower and he managed to get the trace:
First error is related to CartoDB/cartodb#6006, but it's not an stopper.
Second error means that extension is trying to add a new PK to a table that already has it. In this situation PK on cartodb_id should probably be kept.
The text was updated successfully, but these errors were encountered: