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

Order by random() #2721

Closed
mitjans opened this issue Mar 27, 2023 · 3 comments
Closed

Order by random() #2721

mitjans opened this issue Mar 27, 2023 · 3 comments

Comments

@mitjans
Copy link

mitjans commented Mar 27, 2023

Description of issue

Why is it not possible to retreive data randomly using PosgtREST? What are the limitations?

/documents?select=*&order=random()&limit=1'

{
  "code": "PGRST100",
  "details": "unexpected '(' expecting letter, digit, \"-\", \"->>\", \"->\", delimiter (.), \",\" or end of input",
  "hint": null,
  "message": "\"failed to parse order (random())\" (line 1, column 7)"
}
@steve-chavez
Copy link
Member

Previously discussed on PostgREST/postgrest-docs#671.

@TomasHubelbauer
Copy link

@steve-chavez I landed here from the original issue. That repository is now archived. Perhaps this one should be re-opened? Unless it is clear that ordering by random won't be supported in a special way and users should provide their own views/RPCs. However I think random is special enough to have pure PostgREST support without having to do anything on the DB level. WDYT?

@wolfgangwalther
Copy link
Member

The docs repo is archived, but the issues remaing tracked in #3245. This means that the goal is still to just document this better, but there is not "special handling for random" planned.

DrewZN added a commit to DrewZN/ibanag_dictionary_app that referenced this issue Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants