New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug][pgsql] truncating table via Model.destroy fails #4306

Closed
machinshin opened this Issue Aug 12, 2015 · 1 comment

Comments

2 participants
@machinshin

machinshin commented Aug 12, 2015

Model.destroy({truncate: true});

fails to work, i get the error:

Unhandled rejection SequelizeDatabaseError: relation "public.model_table" does not exist

I dug through the sequelize code to this line:
https://github.com/sequelize/sequelize/blob/master/lib/dialects/postgres/query-generator.js#L382
for some reason quoting the table name for truncate fails to work, when i change my local code from:
query = 'TRUNCATE ' + QueryGenerator.quoteIdentifier(tableName);
to:
``query = 'TRUNCATE ' + tableName;`
works fine.

I can work on filing a PR if that would be received?

P.S. names obviously changed to protect the innocent.

@janmeier

This comment has been minimized.

Member

janmeier commented Aug 12, 2015

Hmm, no idea why we call quoteTable, then remove the ticks again....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment