I am totally new to DB. I am trying to write a function in Postgresql where I have two tables. One table has data with column headers as x1, x2, x3, etc... and another table