Error calling saved function

Query to call function:

SELECT update_therapist_availability ({{ therapist_id }}, '[{"day": "Monday", "startTime": "09:00:00", "endTime": "17:00:00", "isAvailable": true}, {"day": "Tuesday", "startTime": "09:00:00", "endTime": "17:00:00", "isAvailable": true}]'::JSON);

Run failed

function is expected to return void as it's used for updating the database

bumping it up for assisstance.

Hi @Vinyasa_Health! Thanks for reaching out.

I don't have a ton of experience with Postgres routines but the error seems to indicate that the therapist_id is being interpreted as a string instead of an integer. I'd try explicitly type casting it as SELECT update_therapist_availability ({{ therapist_id }}::int, ...;.

Is there a reason that you're using a routine instead of an INSERT or UPDATE query? Retool provides a convenient GUI interface for writing those kind of queries, in particular.