I'm refering to this question:

How do I create a user-defined aggregate function?

My table contains Zero-Values so I have tried the example of ypercubeᵀᴹ but I got the message that

(NOT EXISTS (SELECT 1 FROM testmult WHERE wert = 0))

is a boolean and it can't be muliplied with


(Error: "boolean * double precision")

So how can I solve it?


Use MIN() instead of trying to invent PROD(). That way, any 0 will lead to a zero result (assuming all the values are non-negative).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.