2.3. Data type field

The data type widget is one of the most used fields in pgModeler's forms. The purpose of this control is to quickly assign a data type to objects without writing a single line of code. This field is a polymorphic one which means that new fields appear as the user chooses the type that demands some advanced attribute. The data type widget is capable of handling all PostgreSQL built-in types, extended types like PostGiS spatial ones and user-defined types. The picture below shows the basic shape of this control.

The dropdown control Type is the name of the type being configured where the user can type the name of the data type to quickly locate it without expanding the listing completely. In the mentioned listing the user-defined types including domains, extensions, sequences, tables, and views are listed too, but in this case, their names will be schema-qualified. The next fields L, P, and [] means, respectively, the length (for character varying types), the precision (for numeric and some date-time types), and the dimension (in case of the type is an array). The user can check if the type is being configured as desired by checking the field Format. If the user types any unknown data type in the field Type the format field will display the text invalid_type in red indicating that the type being configured is unknown or invalid and trying to assign it to an object will generate errors.

As told previously, this is a polymorphic field and sometimes additional fields will be presented to the user. The types which enable additional attributes are the date-time ones like interval, time, timestamp, and the PostGiS ones like geometry and geography. Below these additional attributes are displayed.


Feb 20, 2023 at 18:12