rap2hpoutre / pg-anonymizer

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

Error: Nonexistent flags #52

Open nsaud01 opened 1 year ago

nsaud01 commented 1 year ago

This command was working great until fairly recently

npx pg-anonymizer postgres://"${PROD_POSTGRES_USER}":"${PROD_POSTGRES_PASSWORD}"@"${PROD_POSTGRES_HOST}":5432/"${PROD_POSTGRES_DB}" --no-privileges --no-owner --clean --if-exists -T "Changelog"

This has been failing with the following error: › Error: Nonexistent flags: --no-privileges, --no-owner, --clean, › --if-exists, -T, -T, -T › See more help with --help

Have the ability to add pgdump flags been removed?

Thanks!

Eyjafjallajokull commented 9 months ago

No, you need to separate pg-anonymizer arguments from pg_dump arguments with --, e.g.:

npx pg-anonymizer postgres://"${PROD_POSTGRES_USER}":"${PROD_POSTGRES_PASSWORD}"@"${PROD_POSTGRES_HOST}":5432/"${PROD_POSTGRES_DB}" -- --no-privileges --no-owner --clean --if-exists -T "Changelog"
Lelandi commented 9 months ago

Greetings. Confirmed. Version 0.8.0 doesn't accept more than 1 "-T" command. @Eyjafjallajokull this commmand for example: npx pg-anonymizer postgres://"${PROD_POSTGRES_USER}":"${PROD_POSTGRES_PASSWORD}"@"${PROD_POSTGRES_HOST}":5432/"${PROD_POSTGRES_DB}" -- --no-privileges --no-owner --clean --if-exists -T "Changelog" -T "AnotherTable"

Will return the error:

ls/pg-dump.js:14
        throw new errors_1.CLIError(`pg_dump command error: ${data.toString()}`);
        ^

CLIError: pg_dump command error: pg_dump: error: too many command-line arguments (first is "AnotherTable")
Try "pg_dump --help" for more information.

I'm using 0.7.0 (with some command changes and it's working flawlessly)