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 bugs for testing with Redshift (include a new feature; add columun with UNIQUE) #134

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

shimizukawa
Copy link
Member

@shimizukawa shimizukawa commented Jul 15, 2024

  1. FAILED: test_inspectdb; inspectdb should suppress output 'id = AutoField(primary_key=True)'
  2. FAILED: test_alter_size
  3. FAILED: test_alter_size_for_unique

@shimizukawa shimizukawa self-assigned this Jul 15, 2024
@shimizukawa
Copy link
Member Author

shimizukawa commented Jul 16, 2024

FAILED: test_alter_size

E django.db.utils.NotSupportedError: cannot decrease a VARCHAR column size with default value

inspection

#96 (comment)

to be fixed

  1. adding new column with decreased size
  2. migrate data from old to new column.
  3. drop old column.
  4. rename new column.

@shimizukawa
Copy link
Member Author

shimizukawa commented Jul 16, 2024

FAILED: test_alter_size_for_unique

E django.db.utils.NotSupportedError: ALTER TABLE ADD COLUMN does not support columns defined with UNIQUE or PRIMARY KEY constraints

inspection

While sequentially checking the SQL issued by the test code, I encountered an error when adding a column with a UNIQUE constraint.

=# CREATE TABLE foo (id INTEGER);
=# ALTER TABLE "foo" ADD COLUMN "name" varchar(20) UNIQUE;
ERROR: ALTER TABLE ADD COLUMN does not support columns defined with UNIQUE or PRIMARY KEY constraints

Therefore, while the previously implemented "resizing columns with a UNIQUE constraint" is functioning, the test code that uses "adding a column with a UNIQUE constraint" encountered an error. I did not notice this issue during CI because the validation was performed using Postgres instead of Redshift.

The SQL execution log is summarized in the comment at the following link:
#96 (comment)

To be fixed

I have now implemented support for "adding a column with a UNIQUE constraint."

shimizukawa added a commit that referenced this pull request Jul 16, 2024
shimizukawa added a commit that referenced this pull request Jul 16, 2024
… not accept ADD COLUMN with UNIQUE, so we neet adding column without UNIQUE then add UNIQUE CONSTRAINT.
shimizukawa added a commit that referenced this pull request Jul 16, 2024
…se the size of a column that have default.
…NIQUE then add UNIQUE CONSTRAINT.

This change also fixes test_alter_size_for_unique with redshift.
…se the size of a column that have default.
@shimizukawa shimizukawa marked this pull request as ready for review July 17, 2024 03:24
@shimizukawa shimizukawa changed the title WIP: bugfix for testing with Redshift bugfixes for testing with Redshift (include a new feature; add columun with UNIQUE) Jul 17, 2024
@shimizukawa shimizukawa changed the title bugfixes for testing with Redshift (include a new feature; add columun with UNIQUE) fix bugs for testing with Redshift (include a new feature; add columun with UNIQUE) Jul 17, 2024
@shimizukawa shimizukawa merged commit 829b1dc into master Jul 17, 2024
26 of 27 checks passed
@shimizukawa shimizukawa deleted the fix-testing-with-redshift branch July 17, 2024 03:26
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.

1 participant