Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > SELECT n, > exp( sum( ln( n ) ) OVER ( ORDER BY n ) )::NUMERIC AS lfd_prod, > exp( sum( ln( n ) ) OVER ( ORDER BY n ) )::INTEGER AS lfd_prod_int > FROM generate_series( 1, 10) AS n > > <pre> > n | lfd_prod | lfd_prod_int > -: | ---------------: | -----------: > 1 | 1 | 1 > 2 | 2 | 2 > 3 | 6 | 6 > 4 | 24 | 24 > 5 | 120 | 120 > 6 | 720 | 720 > 7 | 5040 | 5040 > 8 | 40320 | 40320 > 9 | 362880 | 362880 > 10 | 3628800.00000001 | 3628800 > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=postgres_10&fiddle=e187922a907b38a8e7cad2966e92ea8a)*
back to fiddle