'How to Run Postgresql procedures with Knex in Node js

I am trying to call a stored procedure saved in the public schema using:

const schema = await knex.raw("call create_schema(?, 'col1', 'col2', 'col3', 'col4', 'col5', 'col6')",
        schema_name);

The procedure is to create a schema for a new tenant in the database.

However, I keep getting this error:

"call create_schema($1, 'col1', 'col2', 'col3', 'col4', 'col5', 'col6') - procedure create_schema(unknown, unknown, unknown, unknown, unknown, unknown, unknown) does not exist"

Please what could be the problem and how I can solve it.



Solution 1:[1]

So apparently, I needed to use knex.schema.raw(). Also, I used the wrong database name that didn't have the procedure in it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fhuad Balogun