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 postgres detect serial in autogenerate (#1479) #1486

Closed
wants to merge 3 commits into from
Closed

Fix postgres detect serial in autogenerate (#1479) #1486

wants to merge 3 commits into from

Conversation

JabberWocky-22
Copy link

Fixes: #1479

Description

In #73, it tries to detact postgresql serial in autogenerate, so it won't take nextval('seq'::regclass) as server default for that column.
But it takes not effect for tables not in search path. This PR fixed it.

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, left a suggestion regarding the tests

Can you also add a changelog, similar to these one? https://github.com/sqlalchemy/alembic/tree/main/docs/build/unreleased

@@ -860,7 +860,7 @@ def teardown_class(cls):

@provide_metadata
def _expect_default(self, c_expected, col, seq=None):
Table("t", self.metadata, col)
Table("t", self.metadata, col, schema="test_schema")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to have both cases tested.

I think you could be better to have a parameter passed to the outside to enable /disable the schema. Then we could have separate tests that run or not the schema (if could also use combinations())

@JabberWocky-22
Copy link
Author

change log and more test has been added
Please review it XD

@CaselIT
Copy link
Member

CaselIT commented Jun 5, 2024

thanks. I'll bring in it gerrit were the complete pipeline can run

@CaselIT CaselIT requested a review from sqla-tester June 5, 2024 19:28
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision 24df8f9 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

New Gerrit review created for change 24df8f9: https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/5333

Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Michael Bayer (zzzeek) wrote:

This seems OK but I need to know very clearly how on earth that comparison works, and if we could perhaps have something that looks a little more explicit /safe that would be an improvement. this needs a comment at the very least how we can know this bizarre comparison is safe

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/5333

alembic/ddl/postgresql.py Show resolved Hide resolved
@sqla-tester
Copy link
Collaborator

Michael Bayer (zzzeek) wrote:

it's documented here: https://www.postgresql.org/docs/current/datatype-oid.html

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/5333

@sqla-tester
Copy link
Collaborator

Michael Bayer (zzzeek) wrote:

code review left on gerrit

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/5333

@sqla-tester
Copy link
Collaborator

Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/5333 has been merged. Congratulations! :)

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.

autogenerate failed to detect postgresql serial
4 participants