![]() ![]() Accepted values are NO ACTION, RESTRICT, CASCADE, SET NULL, and SET DEFAULT. Indicates which action must be taken when an element on the referenced table is deleted. Refer to the table's DDL command documentation for details. Possible values are MATCH SIMPLE, MATCH FULL, and MATCH PARTIAL. Specifies how values inserted into the referencing column(s) are matched against the value of the referenced column in the referenced table. It requires that a group of columns in the source (or referrer) table only contains values that match the values in columns of the rows of the referenced table. This object's grid is used to set the columns that will form the constraint.Ī foreign key is one of the most important constraints when it comes to data integrity. Accepted values are INITIALLY IMMEDIATE and INITIALLY DEFERRED. Specifies the deferral mode when the constraint is deferrable. Specifies if the constraint can be deferred or not. Details about the fill factor attribute can be seen on PostgreSQL documentation. This means that if your table is intended to have lots of updates you should use a small fill factor, on the other hand, static tables or least updated ones can use a greater fill factor to save disk space. This attribute is related to how much (in a percentage from 10 to 100) the table/constraint pages are packed (in terms of physical space usage). The image below shows all the fields related to this kind of constraint. Technically speaking, a primary key is a combination of a unique and a not-null constraint. Primary keys specify that one or more columns of a table can store only unique (non-duplicated) and non-null values. In pgModeler, once created a constraint, its type (primary key, foreign key, unique, etc) can't be changed due to its strong linking to the relationship objects and the columns/constraints propagation mechanism (explained further in this documentation). The constraint objects are shown in the table's extended attributes area (the bottom portion) in the same place where other objects like triggers, rules, indexes, and policies are listed. The image below shows an example of these constraint codes. The two-letter codes for constraints are: pk (primary key), fk (foreign key), uq (unique), ck (check), ex (exclude) and nn (not-null). Graphically, in pgModeler database models, for each constraint in which a column is a participant a two-letter code will be appended to a string surrounded by « », this way the user is able to quickly identify which constraints the column is in. These constraints will be detailed in the next sub-sections. The PostgreSQL implements six different types of constraints, being them: primary keys, foreign keys, unique keys, check, exclude and not-null. Constraints are objects that provide data integrity in tables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |