GitHub user dosubot[bot] added a comment to the discussion: Need help setting 
up Superset chart in AWS EKS behind ALB

<!-- Answer -->
This error happens because PostgreSQL ENUM types like `emaildeliverytype` 
persist in the database even after you drop all tables—they aren't removed by a 
typical "wipe." Superset's migration tries to create the type again, but if it 
already exists, you get the `DuplicateObject` error.

To fix this, manually drop the lingering ENUM type before rerunning migrations:

```sql
DROP TYPE IF EXISTS emaildeliverytype;
```

You can run this in `psql` or any SQL client connected to your metadata DB. If 
you want to fully reset Superset's DB, also check for other custom types and 
drop them as needed.

For future resets, consider scripting the cleanup of persistent types. Superset 
migrations don't currently check for or drop existing ENUMs before creating 
them, so manual cleanup is required 
([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2018-05-15_20-28_6c7537a6004a_models_for_email_reports.py#L35-L102)).


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/a1cfe183-58a1-45f3-808d-5a71e0a4621b?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/a1cfe183-58a1-45f3-808d-5a71e0a4621b?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/a1cfe183-58a1-45f3-808d-5a71e0a4621b?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/a1cfe183-58a1-45f3-808d-5a71e0a4621b?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/a1cfe183-58a1-45f3-808d-5a71e0a4621b?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/a1cfe183-58a1-45f3-808d-5a71e0a4621b?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/a1cfe183-58a1-45f3-808d-5a71e0a4621b?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20error%20happens%20because%20PostgreSQL%20ENUM%20types%20like%20%60emaildeliverytype%60%20persist%20in%20the%20database%20even%20after%20you%20drop%20all%20tables%E2%80%94they%20aren%27t%20removed%20by%20a%20typical%20%22wipe.%22%20Superset%27s%20migration%20tries%20to%20create%20the%20type%20again%2C%20but%20if%20it%20already%20exists%2C%20you%20get%20the%20%60DuplicateObject%60%20error.%0A%0ATo%20fix%20this%2C%20manually%20drop%20the%20lingering%20ENUM%20type%20before%20rerunning%20migrations%3A%0A%0A%60%60%60sql%0ADROP%20TYPE%20IF%20EXISTS%20emaildeliverytype%3B%0A%60%60%60%0A%0AYou%20can%20run%20this%20in%20%60psql%60%20or%20any%20SQL%20client%20connected%20to%20your%20metadata%20DB.%20If%20you%20want%20to%20fully%20reset%20Superset%27s%20DB
 
%2C%20also%20check%20for%20other%20custom%20types%20and%20drop%20them%20as%20needed.%0A%0AFor%20future%20resets%2C%20consider%20scripting%20the%20cleanup%20of%20persistent%20types.%20Superset%20migrations%20don%27t%20currently%20check%20for%20or%20drop%20existing%20ENUMs%20before%20creating%20them%2C%20so%20manual%20cleanup%20is%20required%20%28%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2018-05-15_20-28_6c7537a6004a_models_for_email_reports.py%23L35-L102%29%29.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/36296)

GitHub link: 
https://github.com/apache/superset/discussions/36296#discussioncomment-15165039

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to