fergusstrange / embedded-postgres

Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test
MIT License
851 stars 89 forks source link

Absolutely not concurrency-safe #112

Closed karelbilek closed 1 year ago

karelbilek commented 1 year ago

This is absolutely not concurrency-safe and I keep tripping over various bugs all over the place when I try to run more postgresses at the same time.

I cannot even run one postgres easily and create more databases.

Are there plans to tackle this?

karelbilek commented 1 year ago

There is this fork that seems to fix a lot of that

https://github.com/PaddleHQ/embedded-postgres/tree/sync

ping @alecsammon

karelbilek commented 1 year ago

ah even that fork fails, as the cache is still shared

fergusstrange commented 1 year ago

Hey @karelbilek we have some code we think will tackle this issue that I'm hoping to merge over the coming weeks. I'll post updates to this issue when that happens.

Regarding creating a secondary database, you should be able to achieve this with CLI tools once the initial one is spun up or using a DDL statement such as CREATE DATABASE mydatabase before you start your tests.