You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
fist of all: big kudos for the module! Guys you've done an amazing piece of work here!
I have a problem or possibly a bug. postgres: When using parameterized text based query order by clause parameters are not working (are ignored)
My simplified query: SELECT * FROM "sourceTable" WHERE 1=1 ORDER BY :orderBy DESC LIMIT :topn
then I use: await database.fetch_all(query=QRY, values = {"orderBy": "startTime","topn":1}
and debug says: DEBUG:databases:Query: SELECT * FROM "sourceTable" WHERE 1=1 ORDER BY $1 DESC LIMIT $2; Args: ('startTime', 1)
but results are not ordered at all.
One can provide a non-existing column and query is still execuded, e.g., DEBUG:databases:Query: SELECT * FROM "rfb_active_tests" WHERE 1=1 ORDER BY $1 LIMIT $2; Args: ('who_ate_the_cookies_from_the_cookie_jar ', 1)
and results are the same.
I've tried several approaches including ASC or DESC in the orderBy parameter itself or by providing a Tuple, but apparently none worked.
Unfortunately I have to use text SQL queries.
Is it a bug or am I doing something wrong?
How shall I pass the order by parameters (REST param) to avoid e.g SQLInjections then?