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

fix: EXPOSED-151 Quoted identifiers cause incorrect schema validation #1842

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

bog-walk
Copy link
Member

If a table object is created with user-quoted table and/or column names, attempting to validate it using either SchemaUtils.createMissingTablesAndColumns() or SchemaUtils.statementsRequiredToActualizeScheme() incorrectly generates CREATE and ALTER statements.

This happens because metadata returned by the database does not generally include quotes.
So any comparison check with the cached identifiers (which do include quotes) in Table.exists() or SchemaUtils functions causes false negative results.

Table and column functions that process/unquote the respective names are introduced to ensure a more accurate equality check with metadata.

If a table object is created with user-quoted table and/or column name, unnecessary
CREATE and ALTER statements are generated by SchemaUtils validation functions.

This happens because returned metadata does not include quotes (except MySQL),
so comparisons with cached identifiers gives false results.

Ensuring that functions in SchemaUtils, JdbcDatabaseMetadataImpl, and Table.exists()
use the correct table or column name without quotes allows more accurate
equality checks.
@bog-walk bog-walk requested review from e5l and joc-a August 24, 2023 01:21
@bog-walk bog-walk merged commit 97c333b into main Aug 24, 2023
3 checks passed
@bog-walk bog-walk deleted the bog-walk/fix-quoted-identifier-validation branch August 24, 2023 17:33
saral pushed a commit to saral/Exposed that referenced this pull request Oct 3, 2023
…JetBrains#1842)

If a table object is created with user-quoted table and/or column name, unnecessary
CREATE and ALTER statements are generated by SchemaUtils validation functions.

This happens because returned metadata does not include quotes (except MySQL),
so comparisons with cached identifiers gives false results.

Ensuring that functions in SchemaUtils, JdbcDatabaseMetadataImpl, and Table.exists()
use the correct table or column name without quotes allows more accurate
equality checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants