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 500 error when loading projects list with PostgreSQL 13 and older #4686

Merged
merged 2 commits into from Oct 17, 2023

Conversation

noliveleger
Copy link
Contributor

@noliveleger noliveleger commented Oct 17, 2023

Description

Make the default projects sorting (i.e. deployed, draft, archive) work with older versions of PostgreSQL.

Notes

OrderRandom ORM utility has been renamed to a more explicit name: OrderCustom

Supersedes #4685

@noliveleger noliveleger assigned bufke and unassigned bufke Oct 17, 2023
@noliveleger noliveleger added API Changes related to API endpoints bug-fix and removed API Changes related to API endpoints labels Oct 17, 2023

function = 'array_position'
template = '%(function)s(ARRAY%(order_list)s, %(expressions)s)'
arity = 1

def __init__(self, expression: str, order_list: list, **extra):
def __init__(self, expression: str, order_list: list, array_type: str, **extra):
Copy link
Contributor

Choose a reason for hiding this comment

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

array_type: str is a required argument. It's allowed to be Literal['varchar'] to get the desired varchar behavior else it will use the implicit cast. Thus to use implicit cast, it must be called with array_type='unicorns' to function as None isn't accepted.

How about making the type Optional[literal['varchar']] = None

If we're going to place the type hint, we should as well make the type useful. Then it can be omitted to use implicit cast and mypy would error if set to unicorns, which is silly.

@bufke bufke merged commit eb1e7f3 into release/2.023.37 Oct 17, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants