Skip to content
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

postgres model.drop() throws error without options object passed #13184

Open
5 tasks
aliatsis opened this issue Apr 10, 2021 · 4 comments
Open
5 tasks

postgres model.drop() throws error without options object passed #13184

aliatsis opened this issue Apr 10, 2021 · 4 comments
Labels
dialect: postgres For issues and PRs. Things that involve PostgreSQL (and do not involve all dialects). type: bug

Comments

@aliatsis
Copy link

Issue Description

When using postgres dialect, calling model.drop() throws an error such as:
Cannot set property 'supportsSearchPath' of undefined

What do you expect to happen?

The drop options should be optional and should not error if not passed

What is actually happening?

It appears the abstract query interface relies on a super call to default the options object. However, the mutated options reference in the super function is not available in the child dropTable function so options is still undefined when supportsSearchPath is trying to be set

Output here

Additional context

Add any other context or screenshots about the feature request here.

Environment

  • Sequelize version: 6.6.2
  • Node.js version: 14.16
  • Operating System: MacOS Catalina
  • If TypeScript related: TypeScript version: 4.1.3

Issue Template Checklist

How does this problem relate to dialects?

  • I think this problem happens regardless of the dialect.
  • [X ] I think this problem happens only for the following dialect(s): postgres
  • I don't know, I was using PUT-YOUR-DIALECT-HERE, with connector library version XXX and database version XXX

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I don't know how to start, I would need guidance.
  • [X ] No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂

@aperkaz
Copy link

aperkaz commented Feb 22, 2022

For future reference, the error goes away when passing an empty object as parameter: dbConnection.sequelize?.drop({})

@ephys
Copy link
Member

ephys commented Feb 22, 2022

Looks like a bug in the postgres dialect caused by this line:
https://github.com/sequelize/sequelize/blob/main/src/dialects/postgres/query-interface.js#L240

@ephys ephys reopened this Feb 22, 2022
@ephys ephys added dialect: postgres For issues and PRs. Things that involve PostgreSQL (and do not involve all dialects). type: bug and removed stale labels Feb 22, 2022
@wbourne0
Copy link
Member

fwiw this is also an issue with queryInterface.dropTable. Should be a pretty trivial fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialect: postgres For issues and PRs. Things that involve PostgreSQL (and do not involve all dialects). type: bug
Projects
None yet
Development

No branches or pull requests

4 participants