Background
Hundreds of database objects (views, packages, stored procedures, etc.) in a system have no formatting and no source code comments. We’d like to:
- Automatically reformat the code (using the General SQL Parser).
- Automatically copy a standard comment header into each object’s source file.
Problem
We cannot push such sweeping changes into production without being tested.
Question
How would you verify that the reformatted source code is functionally identical to the un-formatted code?
Thank you!
Easy:
They should be identical.
The reason they should be identical is that postgres parses the SQL into its standard, canonical form, so even adding unnecessary brackets for example should result in the same internal version of the code.