Outsystem system table hacking

Outsystem system table hacking


I have created a script in sql which drops unused columns as reported by the compiler (Database Integrity Suggestion
Inconsistent database table and entity definitions: column 'osusr_xxx.col_a' exists in database, but there is no corresponding attribute in entity 'YYYY'.. )
It works nicely dropping constraints and tables.
But the messages do not disapear all, after some investigations I found out that OutSystems sometimes drops the attribute from the system catalog but also sometimes sets the attibutes is_active to 0. I can drop the entry from the system catalog but will that be a problem? Any other way to cleanup the outstems system catalog, will it happen when I drop older versions with Service Center?

Hello Wim


The Agile Platform has a policy of not deleting data from the application's managed entities, meaning that when publish a new version of an espace that no longer has a particular entity attrbiute, the correspondent column in the database will not be deleted.


The Agile Platform follows this guideline to avoid runtime errors in consumer espaces that still haven't been refreshed and recompiled after a producer espace change on the entity datamodel. Additional, there's always the concern of avoiding deleting sensitive data from the database, without possibiliy of recovering it. Thus, the Agile Platform manages the datamodel with metadata that tells the applicaiton which entity attributes are avaialble, and hence, which columns in the database table.


The warnings during compilation exist to alert the developer that the database datamodel is different than the one defined on the espace, and that usage of patterns like SELECT * in advanced queries, might generate runtime errors, because the database table will return more columns than what the application is expecting. Beyond that, these warnings really don't have any other impact.


If you feel that the old columns in the database datamodel have impact on your application (like performance issues, or table size, or even sensitive data that you don't what to let it lay around), then I suggest you delete the column from the database table. If not, just let it laying around.


Regarding the system metadata for entity attributes (which you can find in the ossys_entity_attr table inside the OutSystems cataslog), we recommend not to change manual at any given time. Changes on the system metadata can cause data corruption, leading to publication and runtimes issues that will only be recovered by restoring the the data again.


But if you must, before making any changes directly on the database, please make sure you backup the Outsystems catalog first!


Performing the Delete Old espace versions in Service Center will not drop entity metadata, so I won't expect to have the attribute references removed by this action.




Miguel Simões João



Hi Wim,

Is it possible to share the script?

I'm using this script  to find tables not referended by OutSystems espaces.