I expected results when I run a query passing an array of integers as the second argument to width_bucket such as this:
select width_bucket(5, array[0, 1, 2, 3, 4, 5, 6, 7, 8] )
But if this array contains a decimal number such as this:
select width_bucket( 5, array[0, 1.1, 2, 3, 4, 5, 6, 7, 8] )
I get the error:
ERROR: function width_bucket(integer, numeric[]) does not exist
LINE 1: select width_bucket( 5, array[0, 1.1, 2, 3, 4, 5, 6, 7, 8] )
^
My use case is I'm using this function to calculate my data's breaks, which won't always be integers (and I've seen used elsewhere used with width_bucket in that codebase so I'm not sure why it's not working here).
How can I get width_bucket to accept an array of non-integers?
[Edited to add link to the Postgres docs for the width_bucket function, which says that it accepts "anycompatiblearray" although I don't see where the list of "compatible" array types are defined.]
width_bucketfunction?width_bucketis a built-in function so I'm not creating it and thus can't define it with different parameters.width_bucketbut it's not defined in PSQL: doxygen.postgresql.org/… So I don't see how I can run something likeCREATE FUNCTION width_bucket(APPROPRIATE ARGUMENTS HERE). I understand what you're saying in principle but I don't see how I can implement it. If you have any guidance that would be great.width_bucket?