Postgres arrays and records do not fully support custom types. When encountering an unknown OID, they currently default to using `PgTypeInfo::with_oid`. This is invalid as it breaks the invariant that decoding only uses resolved types, leading to panics.
This commit returns an error instead of panicking. This is merely a mitigation: a proper fix would actually add full support for custom Postgres types. Full support involves more work, so it may still be useful to fix this immediate issue.
Related issues:
- https://github.com/launchbadge/sqlx/issues/1672
- https://github.com/launchbadge/sqlx/issues/1797
* refactor: Reuse a cached connection instead of always recreating for `sqlx-macros`
* fix: Fix type inference issue when no database features used
* refactor: Switch cached db conn to an `AnyConnection`
* fix: Fix invalid variant name only exposed with features
* fix: Tweak connection options for SQLite with `sqlx-macros`
* fix: Remove read only option for SQLite connection
* fix: Fix feature flags regarding usage of `sqlx_core::any`
* Make PgLTree::push infallible and take PgLTreeLabel directly.
Previously the function took strings and parsed them into
PgLTreeLabel internally, now it's possible to directlry push
PgLTreeLabels onto a PgLTree.
* Push PgLTree String conversion to label.
* rebase and fix compile error
Co-authored-by: Austin Bonander <austin@launchbadge.com>
* postgres: use Oid type instead of u32
* Make serde happy
* Expose the inner u32
* docs
* Try to fix tests
* Fix unit tests
* Fix order
* Not sure what happened here
git2-rs recently updated major versions due to libgit2 doing the same.
Bump the version used in sqlx accordingly, to allow users of the new
git2 to use git2::Oid with sqlx.
* Add Query builder
* Make query_builder.rs in sqlx-core
* Add QueryBuilder::new()
* Add QueryBuilder::push()
* Define questions for documentation
* Get new, push, push_bind working with types
* Handle postgres' numbered bind varaibles
* Add a test for QueryBuilder#build
* Move arguments into Option
* Refactor query builder
* Finish testing QueryBuilder#build
* Remove design doc
* Add a test for pushing strings with push_bind
* Integration test green
* Adjust some tests
* Make query builder generic about placeholder segmenent ('$N' or '?')
* Run fmt
* Redesign Arguments#format_placeholder in line with code review
* Use write! to push sql to QueryBuilder
* Add QueryBuilder::reset to allow for QueryBuilder reuse
* Run cargo fmt
Right now, there is only a `run` function to programatically run the
migrations, which is great, but nothing to run the migrations down.
This function adds the possibility to undo the migrations until a
specific version (could say -1 or 0 to remove them all).
With this feature, it's now possible, in the end to end or integration
tests to run the migrations and undo them between each test set and
therefore test the migrations themselves.
This is the kind of feature that some ORM have like sequelize in nodejs
that allow you to undo migrations programatically.
Reference to the doc:
https://sequelize.org/v7/manual/migrations.html#undoing-migrations
Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
* Reproduce github issue#1249: Left joins in sqlite can break the query macros
* Fix panic caused by unknown cursor columns when executing NullRow command. Fixes#1249
* Implement PgHasArrayType for JSON types in the serde_json crate
* Remove redundant Type impls for arrays and Vecs of JsonValue
* Relax an implicit Sized bound to support JsonRawValue
I'm having panics on those index accesses, an empty packet is probably a symptom of other problems, but it would be cool if the application doesn't panics like it does.