hey guys, i want to create a function that returns...
# sql
g
hey guys, i want to create a function that returns array of ids, tried something like that
Copy code
CREATE OR REPLACE FUNCTION random_questions()
RETURNS int[] AS $$
  SELECT array[id] FROM questions ORDER BY random() LIMIT 10;
$$
LANGUAGE SQL;
and this returns an array only one id, what i am doing wrong? any ideas?