Greg Stark wrote:
I know the tendency has been to want to discourage implicit casts, but I think this is a good use for them. The whole point of enums is to have syntactic sugar over integers that let you use nicer syntax but that imposes minimal additional complexity over simply using integers. Maybe my conception of enums is different from yours. My conception is basically that of C enums. Where they're purely a creature of the syntax and type system. At run-time they don't make any effort to prevent you from treating them as integers.
Well, for one thing, I have no plan to allow explicit setting of the internal representational value, as one can do in C. And the fact that it's an int underneath is in implementation detail, IMNSHO. After all, KL just advised using a text domain with a check constraint for enums, so int storage is hardly a fundamental part of enum-ness.
Maybe this all just reflects my background in languages that are more strongly typed than C and have first class enums.
cheers andrew ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org