In PostgreSQL, is it possible to generate a series of repeating numbers? For example, I want to generate the numbers 1 to 10, with each number repeated 3 times:
I don't know if you can do use generate_series like that in PostgreSQL, but i would try a cross join:
SELECT x FROM
(SELECT generate_series(1, 10) AS x) t1,
(SELECT generate_series(1, 3) as y) t2
Edit:
As generate_series already returns a table there's no need for SELECT in a Derived Table:
SELECT x FROM
generate_series(1, 10) AS x,
generate_series(1, 3) as y