Comments (2)
Thanks for filling this bug report. It's definitively helpful to have a good minimal example for this.
That written: I unfortunately see no good way to change the current behavior without running into massive performance problems. I think this essentially boils down to: Change the schema is only supported as long as the various internal caches in the connection are not populated yet. After that it's not safe to reuse the connection again and expect it to continue to work. You need to establish connections at that point by marking your connection pool as stale and reestablish connections. After all you know at that point you are calling these queries that something might go stale, which is more than diesel knows about that particular queries.
That written: I'm open to accept contributions to improve the current behavior, but I would strongly prefer first to have a suggested design before someone starts to implement something. For me that's currently not a priority (well maybe beside just adding a documentation note about this specific behavior).
Relatedly: why is the cache per-connection? We're using a connection pool. So even if Diesel had a way to flush the cache and re-fill it, it's hard for us to go do that on every connection. It'd be really nice if the cache were distributed via a watch channel or something where we could update a canonical copy and then propagate that out to all the consumers that want it. I guess that might be hard if consumers need to modify it themselves as they run into new types that they need?
Simply because there is no pool in diesel, we just provide support for r2d2 and that does not allow to store these information in the pool itself. That only leaves storing them in the connection. I cannot really comment for other third party pool implementations here. Again that's something where I would accept contributions to change it.
from diesel.
@fbecart Please not that this issue is not about the prepared statement cache, but about the oid type cache which is something different. So your post here is off topic. Please create a new discussion if you feel that this needs to be discussed.
from diesel.
Related Issues (20)
- Can not use .eq(Decimal_field + xxx) HOT 4
- Closing a sqlite connection does not clear the -wal and -shm file HOT 4
- Execute single-statement migrations without batch_execute HOT 6
- Linking error for diesel_cli in Alpine despite libraries being installed HOT 5
- Option field check in diesel_derives in incomplete
- The diesel 2.1.5 version cannot close the tls connection HOT 7
- Diesel-Schema not supporting Postgres-SCHEMA HOT 1
- `skip_insertion` results in a compiler error HOT 4
- table with more than one primary_key can not use on_conflict().do_update() HOT 1
- Make empty changeset updates using `.optional()` , either ignore or bypass errors `QueryBuilderError` s.
- Rust-analyzer fails to autocomplete Match with diesel errors (Enum) HOT 4
- Migration Not Generating Correct Schema for Custom Types HOT 3
- Investigate new nightly warning about a soundness hole in the type system
- `diesel print-schema > foo.rs` fails without error message if database url not set HOT 1
- Using diesel CLI with `exclude_custom_type_definitions` has unexpected outcomes HOT 1
- [2.2.0 regression] mysqlclient-sys does not provide bundled bindings for libmysqlclient 21. Consider using the `buildtime_bindgen` feature or contribute bindings to the crate HOT 13
- `belonging_to().inner_join()` and `.select()` with two-item tuple causes build error on sqlite backend HOT 1
- derive(Queryable) doesn't work with a field of `Field` type HOT 1
- Compile Error: assertion `left == right` failed: Unexpected output from mysql_config: `-L/usr/local/mysql/lib -lmysqlclient -lssl -lcrypto -lresolv` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diesel.