Properly reflect column attributes: nulllable, autoincrement, comment #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Changes are made to class method IngresDialect::get_columns to provide reflection of column attributes
autoincrement
andcomment
and to correctly handle columns that are defined as unique constraints.The column attributes fix was prompted by failing tests from ComponentReflectionTest::test_get_multi_columns in the SQLAlchemy dialect compliance suite in which the actual reflected results were missing the attributes
autoincrement
andcomment
which are part of the expected results.Notes on Unique Constraints and Null Values
Per Ingres documentation, Ingres tables do not allow columns specified as unique to contains nulls whereas X100 tables do allow columns specified as unique to contain null values.
PostgreSQL doc indicates that column members of unique constraints can be null.
The SQLAlchemy
get_multi_columns
tests expect that null values are allowed for any column that is part of a unique constraint, and thus with an Ingres database, a number of these tests continue to fail with the code fix of this PR, even though the fix allows the inspection results returned by the dialect to be correct for Actian databases (Ingres, Vector, Data Platform).Many of the related dialect compliance suite tests fail when the database is VectorWise due to an unrelated issue, because the suite tests try to create a table with a self-referencing referential constraint, which is not allowed with X100 tables.
Testing - Dialect Compliance Suite
Ingres 12.0.0
Vector 6.3
It is worth mentioning that in my testing, the dialect compliance suite tests sometimes give differing results for multiple runs even if nothing is changed in between test runs. For example, if the test suite is run 10 times in a row without changing anything in between, the pass/fail rates for half of the runs might be different than the results for the other half of the runs. I have not spent much time trying to understand the reason for this behavior, although suspect it could be a timing issue with the creation/deletion of objects.
Testing - Simple Python program that reflects columns attributes
inspect_columns.py.txt
Given the following table definition in the attached program, results are show below.
With the fixes of this PR, the attributes/values for
nullable
,autoincrement
, andcomment
in the following inspection results are now correct.Results with database: Ingres 12.0.0 GA
Results with database: VectorWise 6.3 build 14614
Results with database: Actian Data Platform 620.0.18 GCS
Client Environment
Internal ticket II-14573