|
Contents:
Search: |
EnumerationWhat is an enumeration?An enumeration is a named set of named integer constants. An enumeration is what?Let's take an example:
CREATE ENUM gender_t = {
NA = -1,
feminine = 1,
masculine = 2
}
This creates a named set (the name is "gender_t") of named integer constants (for example, the integer constant "1" is given the name "feminine"). OK, I get it. Any restrictions?Yes. Both the enumeration name ("gender_t" above) and the enumeration constant names (e.g., "NA", "masculine") must be identifiers. Also, you can't have two constants with the same value in the same enumeration. It is a set, not only in the names, but also in the values. |