Luis Roberto Weck <luisroberto@xxxxxxxxxxxxxxx> writes: > I am trying to generate some random data using the random() function. > However, I am getting the same result over mulitiple rows. This is a > sample of the SQL I am using: > select (select string_agg(random()::text,';') > from pg_catalog.generate_series(1,3,1) ) > from generate_series(1,10,1) The sub-select is independent of the outer select so it's only computed once, and then you get ten copies of that result. Restructuring the query, or inserting an artificial dependency on the outer select's data, would help. regards, tom lane