Commit graph

169 commits

Author SHA1 Message Date
df15dfe7bb
fix: support postgres custom type
See issue https://github.com/launchbadge/sqlx/issues/1920
2025-01-19 21:22:41 +09:00
tison
838a239a2c
docs: add example for postgres enums with type TEXT (#3655)
* docs: add example for postgres enums with type TEXT

Signed-off-by: tison <wander4096@gmail.com>

* revert GitHub naming

Signed-off-by: tison <wander4096@gmail.com>

* add note

Signed-off-by: tison <wander4096@gmail.com>

---------

Signed-off-by: tison <wander4096@gmail.com>
2025-01-15 08:41:57 -08:00
joeydewaal
dfd0ac5974
feat: add Transaction type aliases (#3658) 2025-01-03 00:26:09 -08:00
Rinat Shigapov
4590b9c3ee
close listener connection on TimedOut and BrokenPipe errors (#3648)
* close listener connection on TimedOut and BrokerPipe errors

* use matches macro to generate jump table instead of chain of conditions
2024-12-24 17:00:40 -08:00
Jakub Łabor
fdd4663318 Add PgConnection::is_explain_available 2024-12-24 01:53:37 -08:00
Jakub Labor
20bccf8877 Dont use EXPLAIN in nullability check for QuestDB 2024-12-24 01:53:37 -08:00
James H.
1678b19a46
feat: add geometry line (#3623)
* feat: add geometry line

* fix: point vs line

* fix: try regular comparison for line

* fix: undo point comparison change

* fix: regular comparison for array lines

* fix: remove line array test
2024-12-12 12:52:30 -08:00
joeydewaal
1f6ce33df4
chore: remove BoxFuture's (non-breaking) (#3629)
* chore: reduce BoxFuture's when using recursion.

* remove BoxFuture's in WithSocket

* chore: better document previous changes
2024-12-12 12:43:22 -08:00
Philip Cristiano
42ce24dab8
Add support for Postgres lquery arrays (#3553)
An lquery array can be used with the `?` operator for "Does ltree match
any lquery in array?"

Documentation: https://www.postgresql.org/docs/current/ltree.html#LTREE-OPS-FUNCS

Closes #2246
2024-11-27 19:00:13 -08:00
Gabriel Lopes Veiga
3e140ba384
Derive Copy where possible (#3577)
For database-specific types.
2024-11-27 14:49:08 -08:00
Chris Hanks
4f10962743
Add PgListener::next_buffered(), to support batch processing of notifications (#3560)
* Implement and test PgListener::try_recv_buffered().

* rustfmt

* Fix warnings.

* Fix test.

* Rename try_recv_buffered() -> next_buffered().
2024-11-27 13:56:01 -08:00
Sean Lynch
503a72c94f
Eagerly reconnect in PgListener::try_recv (#3585)
When PgListener's underlying connection is closed, try_recv() will
return Ok(None) and reconnect on the next call. In this case, user code
is supposed to reload its state from the database (or otherwise handle
potentially missing messages). However, if the user code uses another
database connection to do so then there is a period between when the
state is reloaded and PgListener's connection is re-established where
notifications are lost without any indication that this has happened.

This commit changes PgListener to eagerly reconnect by default. At the
suggestion of @abonander on discord, I have also included an option to
switch back to the old behaviour in the case where someone was depending
on it.

Now, if the connection is closed then, by default, user code can do
whatever it needs to do in order to recover and any notifications
emitted in the meantime will be waiting for it when it is done.
2024-11-27 13:52:23 -08:00
Benoit Ranque
e3ef8baf23
URL decode database name when parsing connection url (#3593) 2024-11-27 13:48:34 -08:00
James H.
a7f2928a1b
feat(postgres): point (#3583)
* feat: point

* test: try if eq operator works for arrays of geometries

* fix: re-introduce comparison

* fix: test other geometry comparison

* test: geometry array equality check

* test: array match for geo arrays geo match for geo only

* fix: prepare geometric array type

* fix: update array comparison

* fix: try another method of geometric array comparison

* fix: one more geometry match tests

* fix: correct query syntax

* test: geometry test further
2024-11-27 13:35:42 -08:00
Paolo Barbolini
3e8952b0d4
Bump thiserror to v2.0.0 (#3596) 2024-11-26 11:01:33 -08:00
Jakub Łabor
80314609ac
Use UNION ALL instead of UNION in nullable check (#3605) 2024-11-26 10:59:47 -08:00
Pmarquez
d4ae6ffd88
Implement AnyQueryResult for Sqlite and MySQL (#3608)
* impl AnyQueryResult for Sqlite and MySQL

* fix MySQL AnyQueryResult

* fix MySQL AnyQueryResult

* fix manifest

* rewrite `use` and address implementation concerns
2024-11-26 10:59:20 -08:00
Quentin Gliech
709226c19d
Implement Acquire for PgListener (#3550)
* Implement Acquire for PgListener

* Add a test which checks that PgListener implements Acquire

* Drop unnecessary call to `.acquire()`

* Rename test channel to avoid conflict with other tests
2024-10-28 15:00:06 -07:00
Oleksandr Babak
eac4b7aff7
Fix: Cannot query Postgres INTERVAL[] (#3566)
* fix(sqlx-postgres): macro could not understand pg interval array type

* refactor(sqlx-postgres): move pg interval array types closer to other array types
2024-10-28 14:59:41 -07:00
Dennis Schubert
028084bce3
Demote .pgpass file warning to a debug message. (#3548)
Fixes #3531
2024-10-06 15:21:56 -07:00
Andrei Nesterov
19f40d87a6
Obey no-transaction flag in down migrations (#3528) 2024-10-02 15:32:30 -07:00
joeydewaal
72512f7311
Support PgHstore by default in macros (#3514)
* Support PgHstore in macros

* Change tests

* Remove unused import
2024-10-02 11:56:13 -07:00
joeydewaal
68da5aefea
Box Pgconnection fields (#3529)
* Update PgConnection code

* rustfmt
2024-10-02 11:42:54 -07:00
vsuryamurthy
293c55ce89 Remove unused dependencies from sqlx-core, sqlx-cli and sqlx-postgres 2024-09-24 18:46:31 -07:00
Kurt Wolf
c597a225c5
feat: expose relation_id and relation_attribution_no on PgColumn (#3492)
* expose relation_id and relation_attribution_no on PgColumn

* Update sqlx-postgres/src/message/row_description.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* Update sqlx-postgres/src/column.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* Update sqlx-postgres/src/message/row_description.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* Update sqlx-postgres/src/column.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* Update sqlx-postgres/src/message/row_description.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* fix

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2024-09-07 18:43:03 -07:00
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