Skip to content
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

old syntax used in "drop index" #267

Open
wyriwyg opened this issue Oct 5, 2021 · 3 comments
Open

old syntax used in "drop index" #267

wyriwyg opened this issue Oct 5, 2021 · 3 comments
Labels
enhancement New functionality that could be added help wanted Will probably not be addressed by the package maintainer, but could be addressed by someone else

Comments

@wyriwyg
Copy link

wyriwyg commented Oct 5, 2021

Achilles is using an old syntax for "drop index", which does not work well in certain cases. Here is the error message produced by this drop index statement:

DBMS:
sql server
 
Error:
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot drop the index 'results_deid.idx_ar_aid', because it does not exist or you do not have permission.
 
SQL:
drop index results_deid.idx_ar_aid
 
R version:
R version 3.6.0 (2019-04-26)
 
Platform:
x86_64-redhat-linux-gnu

This syntax is not working well and it has as also described by the official DROP INDEX documentation:

Important

The syntax defined in <drop_backward_compatible_index> will be removed in a future version of MicrosoftSQL Server. Avoid using this syntax in new development work, and plan to modify applications that currently use the feature. Use the syntax specified under <drop_relational_or_xml_index> instead. XML indexes cannot be dropped using backward compatible syntax.

Hope this can be fixed soon.

@fdefalco fdefalco transferred this issue from OHDSI/Achilles Dec 8, 2021
@AnthonyMolinaro
Copy link

This issue was originally posted in Achilles: https://github.com/OHDSI/Achilles/issues/609

DROP INDEX IF EXISTS is newer syntax supported by SQL Server, but not other platforms, and is not currently supported by SqlRender.

@schuemie
Copy link
Member

We can certainly add this new syntax to OHDSI SQL. Could you help by figuring out the equivalent SQL in the other supported dialects (that do support deleting indices if they exist)? For example, DROP INDEX IF EXISTS does exist (using exactly the same syntax) in Postgres.

@AnthonyMolinaro
Copy link

@schuemie Thanks, Martijn. Yes, will do.

@schuemie schuemie added enhancement New functionality that could be added help wanted Will probably not be addressed by the package maintainer, but could be addressed by someone else labels Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New functionality that could be added help wanted Will probably not be addressed by the package maintainer, but could be addressed by someone else
Projects
None yet
Development

No branches or pull requests

3 participants