question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension 'ltree' already exists.

See original GitHub issue

I wrote a test for the migration I am writing by hand, followed the guide for unittest and so on. Now, when I run pytest to run the actual test (this one alone) I get into the followin error:

E               django.db.utils.ProgrammingError: extension "ltree" already exists

I searched here as best as I could but could not find anything.

Worth mentioning we run our tests with pytest and we are using the pytest-django plugin to manage django setup and so on.

Thank you in advance for your help!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mrswatscommented, Dec 14, 2020

But yes, that was it.

The problem stemmed from that first migration that was trying to create the extension twice and by adding the adequate SQL line in the migration that ads the extension fixed it.

Thank you for your help!

0reactions
mrswatscommented, Dec 14, 2020

No, I use pytest as a runner with unittest cases (the DRF unittest anyway, but unittest none the less).

Read more comments on GitHub >

github_iconTop Results From Across the Web

ltree extension installed, but create table still throws error
It will create the extension for the public schema, if no schema is specified. CREATE EXTENSION IF NOT EXISTS ltree;. Share.
Read more >
LTREE extension does not exist after CREATE EXTENSION
The extension ltree is installed in the schema with the object ID 361964. If you want to know the name of that schema,...
Read more >
Installing the Postgres LTREE Extension
If you see the “CREATE EXTENSION” message like this, then you're all set! LTREE was already installed and you just enabled it.
Read more >
Re: BUG #16698: Create extension and search path
CREATE EXTENSION it still says that it already exists. (Tested on 12.4, but ... ERROR: extension "ltree" already exists. Regards,
Read more >
Installing the Postgres LTREE Extension
Learn how to test whether the LTREE extension is installed, use LTREE on a shared Postgres ... error: extension "ltree" already exists.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found