Berend Tober <btober@xxxxxxxxxxxxxxxx> writes: > I'm stuck on not knowing how to define a > aggregate that takes more that one variable as its argument, That's because there isn't any way to do that. It's on the TODO list I believe. In the meantime, you could possibly kluge it up by defining a composite type to be the aggregate's argument, and calling it like SELECT covariance(row(...)) FROM ... regards, tom lane