Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

/admin/users_paginate does not work with postgresql (at least) #2041

Closed
arxcode opened this issue Mar 22, 2017 · 2 comments
Closed

/admin/users_paginate does not work with postgresql (at least) #2041

arxcode opened this issue Mar 22, 2017 · 2 comments

Comments

@arxcode
Copy link

arxcode commented Mar 22, 2017

When trying to use the new /admin/users_paginate admin API like this:

GET /_matrix/client/api/v1/admin/users_paginate/<admin user>?access_token=<redacted>&start=0&limit=10

I receive a 500 Internal Server Error on my synapse on postgresql:

{"errcode":"M_UNKNOWN","error":"Internal server error"}

The logfile shows the following SQL error:

ProgrammingError: FEHLER: Konstante in ORDER BY ist keine ganze Zahl LINE 1: ...st, admin FROM users WHERE is_guest = 0 ORDER BY 'name' ASC...

It complains about the constant 'name' in the ORDER BY clause, which I guess should be a column name instead. I believe the problem is here:

https://github.com/matrix-org/synapse/pull/1784/files#diff-13caa7216e6c08703de17985ecd65997R982

By using the SQL placeholders, I guess it tries to quote the column name instead of inserting it as is (or as quoted column name). I am using PostgreSQL, maybe sqlite handles this differently?

@CHANist
Copy link

CHANist commented Oct 3, 2018

I am using postgresql 9.6, and suffer from the same problem, when try using /admin/users_paginate/ API.

Here is the Error From the server log.
ProgrammingError: non-integer constant in ORDER BY
LINE 1: ...st, admin FROM users WHERE is_guest = 0 ORDER BY 'name' ASC...

Hope one could solve the issue.

@richvdh
Copy link
Member

richvdh commented Jun 19, 2019

dup #3666

@richvdh richvdh closed this as completed Jun 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants