Hackers,
I found this surprising:
david=# CREATE DOMAIN STATUS AS INTEGER CHECK ( VALUE IN (1, 2, 3) );
CREATE DOMAIN
david=# select -4::status;
ERROR: value for domain status violates check constraint "status_check"
david=# select -1::status;
?column?
----------
-1
(1 row)
david=# select (-1)::status;
ERROR: value for domain status violates check constraint "status_check"
So I guess the precedence of :: is higher than -?
Thanks,
David