mitzjukim
postgresql dynamic params
when running a postgres type script (which i understand is rust under the hood)
I am unable to utilize dynamic params when running.
sample script:
-- $1 name1 = 1 hours
SELECT user_id
FROM replica_views.player_view
WHERE user_id IS NOT NULL
AND created_at >= NOW() - INTERVAL "$1::TEXT";
it does work when it's like INTERVAL '1 hours';
also tried it without casting any type. and when moving quotes to input instead of code
also when using single quotes it just returns a null value.
this is the error.
ExecutionErr: error during execution of the script:
Error: db error: ERROR: syntax error at or near "$1": ERROR: syntax error at or near "$1" @handle_child.rs:528:16
should I open a bug, or is it a user error?
5 replies