Skip to content

Add support for reflection of collation in types on PostgreSQL #12510

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dlax
Copy link
Contributor

@dlax dlax commented Apr 8, 2025

The 'collation' returned is None if it matches the default collation for the type. On the other hand, if the column collation matches the one of the database but is explicitly set at column creation, the value is reflected.

Related to #6511.

@dlax dlax marked this pull request as ready for review April 8, 2025 14:31
@dlax dlax force-pushed the issue6511 branch 2 times, most recently from af277b9 to baf48b5 Compare June 17, 2025 07:30
@CaselIT
Copy link
Member

CaselIT commented Jun 18, 2025

sorry for not yet getting a look at this. will try to come to it

@CaselIT CaselIT requested a review from sqla-tester June 18, 2025 22:06
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 baf48b5 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 baf48b5: https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5993

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.

Federico Caselli (CaselIT) wrote:

code review left on gerrit

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

@@ -3801,6 +3802,19 @@ def _columns_query(self, schema, has_filter_names, scope, kind):
== pg_catalog.pg_attribute.c.attnum,
),
)
.join(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Federico Caselli (CaselIT) wrote:

Note to self: this could take advantage of the change in the style of the one added here https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5899

will try to check if it makes sense

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an extra commit to implement this idea (thus removing the JOINs); and rebased.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Except I did it wrong; sorry. I will get back to this in a couple of weeks.

Copy link
Member

Choose a reason for hiding this comment

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

no problem, note that I make take a loot at this before (since it blocks your other prs, right?), in that I'll write about it here.

thanks for the effort in any case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I fixed it; apparently array_agg(<OIDs>) requires a cast in pg8000.

No worries about other PRs, I'll rework them later.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I had to do the same here c3fb776

@dlax
Copy link
Contributor Author

dlax commented Jun 20, 2025

Fixed test failure for empty table case.

@CaselIT CaselIT requested a review from sqla-tester June 20, 2025 13:33
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 62d03e7 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 62d03e7 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5993

@dlax
Copy link
Contributor Author

dlax commented Jun 23, 2025

Rebased to get a working flake8 setup (5c61cc6).

@CaselIT CaselIT requested a review from sqla-tester June 23, 2025 08:34
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 c6ba75f of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset c6ba75f added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5993

dlax added a commit to dlax/sqlalchemy that referenced this pull request Jun 25, 2025
The 'collation' returned by PGDialect._columns_query() is None if it matches the default collation for the type. On the other hand, if the column collation matches the one of the database but is explicitly set at column creation, the value is reflected.

Related to sqlalchemy#6511.

Closes: sqlalchemy#12510
Pull-request: sqlalchemy#12510
Pull-request-sha: c6ba75f

Change-Id: I269a194d526a0689a4b38f10456d28539c73cffb
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.

Denis Laxalde (dlax) wrote:

code review left on gerrit

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

  • lib/sqlalchemy/dialects/postgresql/base.py (line 3805): Done

@dlax dlax force-pushed the issue6511 branch 2 times, most recently from 2725b36 to 4735f0e Compare June 27, 2025 08:43
@CaselIT CaselIT requested a review from sqla-tester June 27, 2025 13:32
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 4735f0e of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 4735f0e added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5993

@dlax dlax marked this pull request as draft June 27, 2025 14:46
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.

Hi, this is sqla-tester and I see you've pinged me for review. However, user dlax is not authorized to initiate CI jobs. Please wait for a project member to do this!

@dlax dlax marked this pull request as ready for review July 15, 2025 07:45
The 'collation' returned by PGDialect._columns_query() is None if it
matches the default collation for the type. On the other hand, if the
column collation matches the one of the database but is explicitly set
at column creation, the value is reflected.

Related to sqlalchemy#6511.
@dlax
Copy link
Contributor Author

dlax commented Jul 15, 2025

@CaselIT, would you mind pulling the latest version in gerrit to get CI jobs running? Thanks.

@CaselIT CaselIT requested a review from sqla-tester July 15, 2025 12:03
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 896aa73 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 896aa73 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5993

@CaselIT
Copy link
Member

CaselIT commented Jul 15, 2025

sure, sorry if this is taking a bit longer to merge.

Following a similar approach to 703a323.

The CAST(..., BIGINT) for array_agg()'s elements is needed for pg8000.
@dlax
Copy link
Contributor Author

dlax commented Jul 15, 2025

New version to fix an issue spotted by alembic tests.

@CaselIT CaselIT requested a review from sqla-tester July 15, 2025 13:38
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 4c2ba73 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 4c2ba73 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5993

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