Skip to content

Added MIN and MAX aggregations#74

Merged
pksunkara merged 7 commits intopksunkara:masterfrom
eXsio:master
Feb 23, 2026
Merged

Added MIN and MAX aggregations#74
pksunkara merged 7 commits intopksunkara:masterfrom
eXsio:master

Conversation

@eXsio
Copy link
Copy Markdown
Contributor

@eXsio eXsio commented Feb 19, 2026

  • added MIN and MAX aggregations (previously required explicit cast)
  • bumped pgrx to 0.17.0

Tests pass for PG 14, 15, 16, 17 and 18.

@eXsio eXsio changed the title Fixed https://github.com/pksunkara/pgx_ulid/issues/45, added MIN and MAX aggregations, added tests for binary protocol Fixed #45, added MIN and MAX aggregations, added tests for binary protocol Feb 19, 2026
@eXsio eXsio changed the title Fixed #45, added MIN and MAX aggregations, added tests for binary protocol Fixed #45, added MIN and MAX aggregations Feb 19, 2026
@pksunkara
Copy link
Copy Markdown
Owner

  1. You need to update the pgrx version in Dockerfile.
  2. The test_ulid_equals_ulid_operator_unique you added doesn't really fail without your fix (tested in Test for #45 #75), so I am unable to say if your PR fixes it or not. Please first make a commit with just that test and prove that it fails.

@eXsio
Copy link
Copy Markdown
Contributor Author

eXsio commented Feb 20, 2026

  1. Updated Dockerfile
  2. Reverted the fix for ERROR: operator is not unique: utils.ulid = utils.ulid in PG 16 #45 - it is not replicable under pgrx conditions and likely is env-dependent. The utils schema from the original ticket had to have some additional config that caused the operator clash. In theory, changing the CAST from IMPLICIT to ASSIGNMENT should alleviate this, but I have no way of proving it via tests. All I really care is adding MAX and MIN, because they fail in currently released version if not used with an explicit cast to either bytea or text.

@pksunkara pksunkara changed the title Fixed #45, added MIN and MAX aggregations Added MIN and MAX aggregations Feb 20, 2026
@pksunkara
Copy link
Copy Markdown
Owner

  1. Update all rust min versions from 1.85.0 to 1.90.0
  2. Use the proper types from pgrx for defining aggregates instead of writing custom sql. https://github.com/pgcentralfoundation/pgrx/blob/develop/articles/postgresql-aggregates-with-rust.md
  3. Make sure all tests pass (including formatting and clippy)

@eXsio
Copy link
Copy Markdown
Contributor Author

eXsio commented Feb 20, 2026

Can you elaborate on point 2?

@pksunkara
Copy link
Copy Markdown
Owner

So, what you wrote while is correct, does not use the Aggregrate trait from pgrx. And since we are using pgrx, it's better to leverage that completely instead of using extension_sql!.

Take a look at the article I linked above and you can understand better

Slawomir Dymitrow added 2 commits February 21, 2026 08:08
@eXsio
Copy link
Copy Markdown
Contributor Author

eXsio commented Feb 21, 2026

OK, made the changes you requested. Switched to pgrx’s Aggregate trait, made sure cargo format-check passes locally.

@pksunkara pksunkara merged commit deae6c6 into pksunkara:master Feb 23, 2026
13 checks passed
@pksunkara
Copy link
Copy Markdown
Owner

In theory, changing the CAST from IMPLICIT to ASSIGNMENT should alleviate this, but I have no way of proving it via tests.

I would really appreciate if you have any additional context or idea on how we can test that.

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.

2 participants