I need to created domain in PostgreSQL for a price. The price must be NUMERIC(9,2) where 9 is precision and 2 - scale. When trying to create domain getting:
ERROR: operator does not exist: numeric ~* unknown
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY:
CREATE DOMAIN d_price AS NUMERIC(9, 2) NOT NULL
CONSTRAINT Product_price_can_contain_only_double_precision_value
CHECK(VALUE ~*'^(([[:digit:]])+\.([[:digit:]]){2})$');
(VALUE::TEXT ~ '^(([[:digit:]])+\.([[:digit:]]){2})$'). You do not need the case-insensitive symbole (*) either. More details at postgresql.org/docs/current/static/functions-matching.htmlnumericcolumn won't let you store non-numeric values anyway[0-9]+\.[0-9]{2}. Ex:25.10;199999.00