I need to generate a view, in postgres, containing n rows based on a value n in a column.
Let's make an example. I have a table like this:
A* | B | C
--------------------
abc | def | 4
ghi | jkl | 7
I need to generate a view made like this:
A | B | C
------------------------
abc | def | 4
abc | def | 4
abc | def | 4
abc | def | 4
ghi | jkl | 7
ghi | jkl | 7
ghi | jkl | 7
ghi | jkl | 7
ghi | jkl | 7
ghi | jkl | 7
ghi | jkl | 7
Is there a way to do it smartly? At the moment I am doing N UNION ALL with N big enough to cover all the cases (e.g. in this case 7).