is there a way to create a customized generic function in PostgreSQL? I would like to create a custom FLOOR function that accepts two parameters and as a result returns a new column in the query result. The first parameter should be the the column of a table and the second the number of significant digits. For example, there is a table (table_foo) with a float column (column_bar). A typical query could be like:
SELECT column_bar, FLOOR(column_bar) FROM table_foo;
I would like a generic function to make similar queries:
SELECT column_bar, CUSTOM_FLOOR(column_bar, 3) FROM table_foo;
I mention the FLOOR function as an example, but it could be a generic function that could be used by any database and any table, the same way FLOOR, POWER etc. are used.