rap2hpoutre / pg-anonymizer

Dump anonymized PostgreSQL database with a NodeJS CLI
https://raph.site
MIT License
223 stars 31 forks source link

Escape postgresql key words in table names #25

Closed mrubczewski closed 2 years ago

mrubczewski commented 2 years ago

When the table in postgresql is named after postgres keywords (i.e. user) in order to escape those keywords they are used with quotes (user -> "user"). Because of that, the anonymization process do not properly match the table names that are being provided by command-line argument with available tables from the database. To fix that I added one more step when extracting table names form SQL that removes optional quotes so the table names are matched even for the postgres keywords. The resulting anonymized SQL script will still have proper table names with quotes as table name that this fix affects is only used for potential anonymization method matching.