3

From Javascript, I want to call a function in my supabase select statement (funcition name is id_encode in this example):

const { data, error } = await supabase
        .from('table')
        .select("id, id_encode(id, 'salt', 8)")

equivalent in SQL would be:

SELECT id, id_encode(id, 'salt', 8) FROM table;
2
  • Alternatively, I could add a column to the table, so long as it's default value is id_encode(id) somehow.
    – Alan
    May 5, 2023 at 22:12
  • 2
    I ended up creating a short_id column that auto-populates with a trigger on insert. Prolly better in the long run for my application. But I'd still like to know if the above question has an answer.
    – Alan
    May 5, 2023 at 23:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.