Autocreate format parameters when generating SQL validation fixtures
When working on !2366 (merged), I didn't want to update the sql_validation
files myself and do a bunch of sed
to set the format parameters myself, so I wrote this.
When an SQL validation file does not exist, instead of just saving the real SQL locally, assertExactQueries
now preprocesses it and tries to turn it into a format string. If you provide it with some format parameters, it will do the search and replace by itself. It also doubles existing brackets, which is useful for empty paths: '{}'::uuid[]
becomes '{{}}'::uuid[]
, which turns back to '{}'::uuid[]
when used in str.format
.
This allows to remove the existing SQL validation files, run the tests again, and just check the diff.