Problem between JS script and queryDB postgresql with additionalScope


I have this JS script that get call a query to get an enum column name to alter the values and call a query with additional scopes

const result = await queryGetSupportTypeEnumReference.trigger()

await queryCreateNewSupportType.trigger({
  additionalScope: {
    supportTypeColumnName : result.enum_type_name[0],
    newSupportTypeName: newSupportTypeName

The function seems to work perfectly.
But when it call the query queryCreateNewSupportType. The additionalScopes don't seem to be retrieved. The query then fail and give this result " * message:"syntax error at or near "$1""

A similar post was made on september 2023, saying that it is normal that it does not work but I am a bit suprised since I feel it is a normal way to use retool. Here is the old topic : AdditionalScope Problem

I would be happy to give extra informations. Hope the community can help me, I have already spent 2 hours on this...

I believe as you're trying to alter a type here and not just set a value, you'll want to switch it to not using prepared statements - that way it wont use $1, $2 etc it will put the exact value of supportTypeColumnName

Thank you, then I guess I won't use "enum" type and find a workaround with text or an extra table