-
Notifications
You must be signed in to change notification settings - Fork 460
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
Recently added schemas don't appear in new connections made in new threads #365
Comments
A bit more debugging:
I've been trying a million things around in here to see if anything makes a different but the command inside the new thread never sees the existence of the recently created postgres schema. |
I think a workaround to this situation is to say that if you need to add new schemas, and you need them to appear in new threads, you should restart your stack. Then hopefully it's sticky across everything. |
Adding I'm going to call this one fixed. |
this is odd? i assume what's happening with i'm unsure why the new thread connection gets a different result though—i assume it's some kind of query/schema cache? maybe try |
I tried both of these calls just before the thread, just inside the top of the new thread, and anywhere else I could think to throw it, but none of them fixed the issue. Thanks for the ideas though! |
Also I checked the Now how can I get a new Thread and a new connection to recognize the new schema? |
no clue, maybe pg is caching it per connection. should be easy enough to test out by connecting via cli or something else, creating a new tenant in rails, then check pg_namespace on cli? |
So far I can't seem to reproduce this outside of my specs. Both my rails console and specs are hitting the same postgres install & user. However in my specs I can reproduce this problem 100% of the time. Very strange! |
I think this might be somewhat related to #186 as my code shares a similar structure to what's described there.
If I replace that lower
.switch!
call withApartment::Tenant.create(schema)
I get an error saying that schema already exists. I would expect that since it existed and connected before, that opening a new Thread after this the schema would still be accessible. Any idea what I can do to work around this?The text was updated successfully, but these errors were encountered: