submitting jsonb via an SQL function
Hello. I would like to have a query that inserts data in mulitple tables at once. My understanding is that the best way to do that is via the "functions" tool in Supabase.
Some context: the user is creating a deck of flashcards. The deck is associated with a lesson, which is associated with a subject. The idea is that the user specifies the subject name, lesson name, and creates a list of cards (or tells OpenAI to do it for them) in the interface before clicking save.
Here is the function on the client side:
Here is the function in Supabase:
I have specified each of the arguments in the Supabase function creator, with the
Here is the format of the parameter being submitted
The error:
Why is the function reading the jsonb as a scalar?
Some context: the user is creating a deck of flashcards. The deck is associated with a lesson, which is associated with a subject. The idea is that the user specifies the subject name, lesson name, and creates a list of cards (or tells OpenAI to do it for them) in the interface before clicking save.
Here is the function on the client side:
Here is the function in Supabase:
I have specified each of the arguments in the Supabase function creator, with the
_cards argument set to jsonbHere is the format of the parameter being submitted
[{"side1":"hello","side2":"hallo"},{"side1":"goodbye","side2":"auf wiedersehen"}]The error:
Why is the function reading the jsonb as a scalar?