Commit graph

144 commits

Author SHA1 Message Date
Pierre Wehbe
fd80f998ac
fix: Use rfc3339 to decode date from text (#3411) 2024-09-02 12:34:51 -07:00
Austin Bonander
e10789d9d7
fix cancellation issues with PgListener, PgStream::recv() (#3467)
* fix(postgres): make `PgStream::recv_unchecked()` cancel-safe

* fix(postgres): make `PgListener` close the connection on-error

* fix: incorrect math in `BufferedSocket::read_buffered()`
2024-08-27 10:54:31 -07:00
Austin Bonander
20ba796b0d fix(postgres): max number of binds is 65535, not 32767 (regression) 2024-08-26 16:20:45 -07:00
kdesjard
371cf4a0cc
Pgsql cube type compile fail (#3459)
* fails to compile as size_of is not found in scope

* keep scoping consistent with other type modules

* fmt fixes

---------

Co-authored-by: kdesjard <kristian.desjardins@nrcan-rncan.gc.ca>
2024-08-26 14:15:48 -07:00
Austin Bonander
9e3ece49d7 fix(postgres): use checked decrement on pending_ready_for_query_count 2024-08-23 23:39:32 -07:00
Austin Bonander
b5c218eb23 fix(postgres): fix missing inversion on PgNumeric::is_valid_digit() 2024-08-23 23:39:32 -07:00
Austin Bonander
01428ff643 fix(postgres): syntax error in EXPLAIN query 2024-08-23 23:39:32 -07:00
Austin Bonander
8919e34357 fix(postgres): syntax error in nullables query 2024-08-23 23:39:32 -07:00
Austin Bonander
56d0225378 chore(postgres): include nullables query in error 2024-08-23 23:39:32 -07:00
Austin Bonander
4fb2dcbe97 fix(postgres): decode PgDatabaseError for ErrorResponse 2024-08-23 23:39:32 -07:00
Austin Bonander
77982cb407 fix(postgres): dead code StatementId::UNNAMED 2024-08-23 23:39:32 -07:00
Austin Bonander
2ab7565bd8 chore: configure clippy cast lints at workspace level 2024-08-23 23:39:32 -07:00
Austin Bonander
53766e4659 refactor(postgres): make better use of traits to improve protocol handling 2024-08-23 23:39:32 -07:00
Austin Bonander
01186a062a fix: audit sqlx_postgres::types::array for bad casts 2024-08-23 23:39:32 -07:00
Austin Bonander
bf13a7706b fix: audit sqlx_postgres::types::hstore for bad casts 2024-08-23 23:39:32 -07:00
Austin Bonander
2a9b85889e fix: audit sqlx_postgres::type::int for bad casts 2024-08-23 23:39:32 -07:00
Austin Bonander
52c34a897a fix: audit PgNumeric and usages for casts involving sign loss 2024-08-23 23:39:32 -07:00
Austin Bonander
cac914fa21 fix: audit sqlx_postgres::types::rust_decimal for casts involving sign loss 2024-08-23 23:39:32 -07:00
Austin Bonander
ea2926135f fix: audit sqlx_postgres::types::bit_vec for casts involving sign loss 2024-08-23 23:39:32 -07:00
Austin Bonander
af9cce726b fix: audit PgValueRef::get() and usage sites for bad casts 2024-08-23 23:39:32 -07:00
Austin Bonander
26c85240fc chore: run cargo fmt 2024-08-23 23:39:32 -07:00
Austin Bonander
d8cb7a2cd6 fix: audit sqlx_postgres::types::cube for overflowing casts 2024-08-23 23:39:32 -07:00
Austin Bonander
8360d48296 fix: audit sqlx_postgres::types::chrono for overflowing casts 2024-08-23 23:39:32 -07:00
Austin Bonander
112b4a84b5 fix: audit sqlx_postgres::types::time for overflowing casts 2024-08-23 23:39:32 -07:00
Austin Bonander
fa5039d6aa fix: audit sqlx_postgres::types::bit_vec for overflowing casts 2024-08-23 23:39:32 -07:00
Austin Bonander
544fff54e2 fix: audit sqlx_postgres::types::rust_decimal for overflowing casts 2024-08-23 23:39:32 -07:00
Austin Bonander
16f8b1900d fix(postgres): prevent integer overflow when binding arguments 2024-08-23 23:39:32 -07:00
Austin Bonander
9ec09fb789 fix: tests in sqlx-postgres 2024-08-23 23:39:32 -07:00
Austin Bonander
6651d2df72
Fix CI after Rust 1.80, remove dead feature references (#3381)
* fix(ci): update workflows/examples.yml

* Removed archived `actions-rs` actions
* Upgraded `Swatinem/rust-cache`, `actions/checkout`, `actions/download-artifact`, `actions/upload-artifact`

* chore: deprecate `AnyKind`

* fix: remove dead references to DB features in `sqlx-core`

This reactivates a couple of tests that had stopped working.

* chore(ci): move sqlx-cli checks to their own workflow

* fix(ci): remove remaining `uses: actions-rs/cargo`

* fix warnings

* chore: add titles to sqlx-cli jobs

* fix warnings (2)

* fix error in pool example

* fix warnings (3)

* fix query_builder test

* fix: don't run CLI tests on Windows

* chore: upgrade `rust-toolchain` to 1.80

* fix(postgres): fix missing Tokio specialization in `PgCopyIn`

Caught by the new `unexpected_cfgs` lint.

* fix new warnings
2024-07-26 23:15:32 -07:00
SrGesus
eaad7b2c9a
doc: Minor rust docs fixes (#3312)
* Fixed some rust docs intra-doc non functioning links

* Minor tweaks

* Added warning for MSSQL not being functional yet

* Fixed requested changes

* Readded missing time

* Aligned table
2024-07-20 12:59:52 -07:00
Kobus Ellis
4683cc34e5
Add support for PostgreSQL HSTORE data type (#3343)
* Add support for PostgreSQL HSTORE data type

* Changes to make the future evolution of the API easier

* Fix clippy lints

* Add basic documentation
2024-07-19 14:33:16 -07:00
JohannesIBK
905df7ef3a
add array support for NonZeroI* in postgres (#3303)
* add array support for NonZeroI* in postgres

* run rustfmt
2024-07-16 13:46:43 -07:00
YgorSouza
f2f17a7bc5
fix(postgres): don't panic if M or C Notice fields are not UTF-8 (#3346)
* fix(postgres): don't panic if `M` or `C` Notice fields are not UTF-8

This has been observed with an old version of PostgreSQL (11.0.4)
running on Windows Server 2016 with windows-1252 encoding and French
locale.

This change replaces invalid UTF-8 fields with a default string, so the
other fields can still be read if they are valid.

* Revert "fix(postgres): don't panic if `M` or `C` Notice fields are not UTF-8"

This reverts commit 362ca98bbd.

* Check that Notice M and C fields are valid UTF-8

Otherwise, we return the invalid UTF-8 error to avoid panicking later.
2024-07-16 00:27:20 -07:00
Eric Torreborre
b71221cd74
use the persistent query setting with the Any driver (#3297) 2024-07-15 16:57:43 -07:00
James H
0db12a9846
feat(cube): support postgres cube (#3188)
* feat: add cube

* docs: cube docs

* docs: update readme

* fix: cube is now not feature flagged

* fix: formatting

* fix: typeo for PgCube vs Cube

* fix: correct types

* fix: postgres only types for cube

* fix: cube readme

* fix: dont unwrap cubes

* fix: typo on interval

* fix: zero volume cube array

* fix: return type

* fix: update tests

* fix: run with one test type

* fix: log bytes in error

* fix: typo in test

* fix: log bytes for failed length

* fix: string deser

* docs: remove cube from readme

* fix: int to float

* fix: trim floats

* fix: exttra test

* fix: type safe into vectors

* fix: improve error messages

* docs: remove comments

* fix: front load most important logic and const at start

* fix: extract constants

* fix: flags

* fix: avoid redundant buffer creation and use FromStr trait

* fix: handle serializing

* test: cube vec test

* fix: no array cube test

* fix: update test with array for cube

* fix: dont use try from for u8

* fix: conditionally remove padding

* fix: conditional trimming

* fix: idiomatic trimming

* fix: linting

* fix: remove whitespace

* fix: lower case array

* fix: spacing input

* test: one more vec test

* fix: trim square brackets in case they are using postgres spec page

* fix: result types

* fix: format

* fix: box error

* fix: the borrow produces a value

* fix: self serialise

* chore: merge main

* fix: borrow

* fix: clippy

---------

Co-authored-by: James Holman <james.holman@betashares.com.au>
2024-07-11 22:30:49 -07:00
Joshua Potts
d1f180fbc5 fix: Minimally upgrade minimal dependencies to resolve build issues on declared minimum versions
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-07-11 11:59:15 -07:00
Austin Bonander
16e3f1025a fix(postgres): add missing type resolution for arrays by name 2024-07-08 00:14:19 -07:00
etorreborre
0eb2ee9365 feat: support the postgres bool type 2024-06-20 18:26:52 -07:00
Cristian Le
92de9d42a6 Add LICENSE-* files to crates 2024-06-20 10:56:08 -07:00
Lílian Ferreira de Freitas
402022df87 fix: use correct names for sslmode options
The names for the SSL mode options were incorrect, added test for making
sure the built url can be parsed to ensure internal consistency at
least. Also changed "ssl-mode" to "sslmode" as it seems more standard
and sqlx can parse both.
2024-06-15 11:59:31 -07:00
Austin Bonander
2618439663 fix(postgres): case-aware type name equality 2024-06-15 11:57:33 -07:00
Austin Bonander
352310ba34 fix: run rustfmt 2024-06-15 11:57:33 -07:00
Austin Bonander
10192019d8 fix(postgres): get correctly qualified type name in describe 2024-06-15 11:57:33 -07:00
Austin Bonander
05a10de4d8 fix: suppress dead_code warnings 2024-06-13 13:11:36 -07:00
Austin Bonander
bae083cf79 fix: clippy warnings 2024-06-13 13:11:36 -07:00
Austin Bonander
0f6054cf81 fix: run cargo fmt 2024-06-13 13:11:36 -07:00
Dario Heinisch
c57bcb967f
Hide docs for any (#3254) 2024-06-05 18:21:10 -07:00
Max Bruckner
c57b46ceb6
Make Encode return a result (#3126)
* Make encode and encode_by_ref fallible

This only changes the trait for now and makes it compile, calling .expect() on all users. Those will be removed in a later commit.

* PgNumeric: Turn TryFrom Decimal to an infallible From

* Turn panics in Encode implementations into errors

* Add Encode error analogous to the Decode error

* Propagate decode errors through Arguments::add

This pushes the panics one level further to mostly bind calls. Those will also be removed later.

* Only check argument encoding at the end

* Use Result in Query internally

* Implement query_with functions in terms of _with_result

* Surface encode errors when executing a query.

* Remove remaining panics in AnyConnectionBackend implementations

* PostgreSQL BigDecimal: Return encode error immediately

* Arguments: Add len method to report how many arguments were added

* Query::bind: Report which argument failed to encode

* IsNull: Add is_null method

* MySqlArguments: Replace manual bitmap code with NullBitMap helper type

* Roll back buffer in MySqlArguments if encoding fails

* Roll back buffer in SqliteArguments if encoding fails

* Roll back PgArgumentBuffer if encoding fails
2024-05-31 12:42:36 -07:00
Austin Bonander
60d033eda2
fix(ci): pin Rust version, ditch unmaintained actions (#3234) 2024-05-14 23:57:31 -07:00
Grzegorz Bartoszek
a5d7fffc1b
Add Debug impl for PgRow (#2917) 2024-04-22 15:39:39 -07:00