In pgModeler it is possible to create objects that are used only for reference purposes having their SQL code disabled. Examples of these objects are the schemas public
and pg_catalog
, the tablespaces pg_default
and pg_global
, the languages c
, sql
and plpgsql
, and the role postgres
. These
objects are automatically created by pgModeler when a new model is added and their only reason to exist is to serve as references to other objects being created on the database model. All previously mentioned objects are commonly known as dummy objects because at the moment an SQL export process occurs their SQL definition will be completely ignored or, in other words, they will not be created on the server even if they are present in the database model.
This feature is quite handy when you need to create additional objects in an already existing database. You can create objects that match the ones on the database and check the option Disable SQL code
on their respective editing forms or use the same action available in the Quick actions
menu to turn them into dummy objects.
Once created the dummy objects you can proceed with the export process and see only the objects with SQL code enabled being created. The dummy ones will not be exported because their code, internally, is commented causing PostgreSQL to ignore them. The dummy objects are ignored in the same way by the diff process which does not produce diff code for them.
To clarify the concept of dummy objects let's use a practical example: assuming that we need to create a new table called table_a
on a database that exists on the server, the table must reference another one called table_b
and again this last object already exists on the server-side. The new object
table_a
also has a column named sample_col
whose data type is the dummy_type
and this object is already present in the database too. Our model will look like the image below.
What it's important to tell at this point is that, in practice, only table_a
and its children will be exported and the two referenced dummy objects table_b
and dummy_type
not. In pgModeler, dummy objects will have their names with a strike-out font style in the model objects widget and for dummy graphical objects, the SQL off
label is attached to them to denote the disabled SQL status as exposed in the image.