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

Anonymous ROW expressions? #216

Open
AnthonySuper opened this issue Nov 19, 2022 · 1 comment
Open

Anonymous ROW expressions? #216

AnthonySuper opened this issue Nov 19, 2022 · 1 comment

Comments

@AnthonySuper
Copy link

Postgres allows you to create anonymous rows for use in queries. This is quite helpful when doing keyset pagination. The following SQL...

SELECT * FROM users
WHERE (userRank, id) > (10, 100)

is much nicer than...

SELECT * FROM users
WHERE userRank > 10
OR (userRank = 10 AND id > 100)

The already-existing Composite type comes close, but it requires that the composite be named, instead of just an anonymous row. Would there be interest in support for this functionality in this library? I could try to make a patch if so.

@ocharles
Copy link
Contributor

ocharles commented Jul 7, 2023

I'm not sure I've been convinced yet. Yes, that SQL might be convenient, but in Rel8 you can already do

where_ $ (userRank, id) >: lit (10, 100)

Does that solve your problem?

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

No branches or pull requests

2 participants