Commit Graph

511 Commits

Author SHA1 Message Date
Lachezar Lechev
41375ebd3c
Update tokio version in feature docs 2021-01-13 11:53:29 +02:00
Jeff Davis
f3cbc8ce04 PgLsn type. 2021-01-09 15:18:26 -08:00
Bernardo Uriarte Blanco
e2d327399b add client method to GenericClient 2020-12-26 23:17:04 +01:00
Steven Fackler
fbc42ecbe8 Stop setting timezone to UTC
Closes #147
2020-12-26 15:51:22 -05:00
Steven Fackler
316c6dc3dc Update codegen sources to 13.1 2020-12-26 14:09:58 -05:00
Steven Fackler
4fb6fd906f Release tokio-postgres v0.7.0 2020-12-25 09:09:17 -05:00
Steven Fackler
71fc3e74bd Release postgres-types v0.2.0 2020-12-25 09:02:02 -05:00
Steven Fackler
06dcebf248 Release postgres-protocol v0.6.0 2020-12-25 08:51:47 -05:00
Nikhil Benesch
f1729e4636 deps: upgrade to tokio v1.0 ecosystem 2020-12-24 18:38:05 -05:00
Steven Fackler
2ab708c4bc minor cleanup 2020-12-17 20:36:15 -05:00
zach-com
9856c7b87a Replace impl From block 2020-12-17 17:55:22 -05:00
zach-com
f655c3b74c Address pull request comments 2020-12-16 15:26:06 -05:00
zach-com
07d9fb2ed6 Support connection validation with timeout 2020-12-11 13:47:39 -05:00
Kirill Fomichev
5099799166
return used features 2020-12-01 19:03:02 +03:00
Kirill Fomichev
fa8fb83ec8
Fix tokio features for runtime feature in the docs 2020-12-01 18:20:37 +03:00
dependabot-preview[bot]
235dfeb95a
Update pin-project-lite requirement from 0.1 to 0.2
Updates the requirements on [pin-project-lite](https://github.com/taiki-e/pin-project-lite) to permit the latest version.
- [Release notes](https://github.com/taiki-e/pin-project-lite/releases)
- [Changelog](https://github.com/taiki-e/pin-project-lite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project-lite/compare/v0.1.0...v0.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-17 13:29:23 +00:00
Steven Fackler
5ad3c9a139 Add back keepalives config handling
Also fix connection timeouts to be per-address
2020-11-05 21:14:56 -05:00
Steven Fackler
bbf31696bb Cleanups 2020-10-27 19:45:55 -04:00
Bernardo Uriarte Blanco
996f063380 map to convert to &dyn ToSql is not longer necessary 2020-10-27 20:31:15 +01:00
Bernardo Uriarte Blanco
0e494a08a9 change rest of *_raw methods to use BorrowToSql 2020-10-27 18:08:23 +01:00
Bernardo Uriarte Blanco
0eab5fad70 make iterators from &dyn ToSql or T: ToSql work as parameters 2020-10-26 20:59:28 +01:00
dependabot-preview[bot]
6561d8129a
Update env_logger requirement from 0.7 to 0.8
Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.7.0...v0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-19 13:23:29 +00:00
Steven Fackler
12e2f03b53 Release tokio-postgres v0.6.0 2020-10-17 15:06:10 -04:00
Steven Fackler
2689070d19 Upgrade to tokio 0.3 2020-10-17 09:49:45 -04:00
Nikhil Benesch
bb961edcc4 Disable chrono's "oldtime" feature to drop time v0.1
The latest version of chrono, v0.4.16, permits removing its dependency
on the long-deprecated time v0.1 crate by disabling the "oldtime"
feature.

For backwards compatibility, chrono is leaving the "oldtime" feature on
by default, so disabling the "oldtime" feature requires disabling all
default features and then re-enabling the one default feature ("clock")
that rust-postgres needs.

Note that this change does not cause any backwards-compatibility
problems for users of rust-postgres. The "oldtime" feature controls only
whether `time_v01::Duration` and `chrono::Duration` are the same type
and does not affect any of the APIs used by rust-postgres.
2020-09-25 15:36:51 -04:00
Juan Aguilar Santillana
a2ca75e9c4 Prettify host cast as str 2020-09-20 10:43:22 +00:00
Juan Aguilar Santillana
391a54aea1 Avoiding get reference of a u16 2020-09-20 10:37:15 +00:00
Joshua Nelson
61f6e3e5c4 Add newline before DETAIL and HINT 2020-08-01 11:12:22 -04:00
Joshua Nelson
ce7ce310b9 Give a more helpful message on error
Before:

```
database error: ERROR: insert or update on table "owner_rels" violates foreign key constraint "owner_rels_cid_fkey"
```

After:

```
database error: ERROR: insert or update on table "owner_rels" violates foreign key constraint "owner_rels_cid_fkey"
DETAIL:  Key (cid)=(4) is not present in table "releases".
```
2020-07-31 20:59:57 -04:00
Nikhil Benesch
a30f0b6c05 Use checked arithmetic when decoding into chrono types
This avoids an overflow panic if the timestamp is the special "infinity"
or "-infinity" value and produces an error instead.

Fix #640.
2020-07-30 22:52:56 -04:00
Steven Fackler
bc682b3103 Explicitly terminate the connection in sync API
Closes #613
2020-07-27 21:42:02 -04:00
shelvacu
c9a21f8398
Add Debug and Clone to AsyncMessage 2020-07-13 15:15:34 -07:00
Steven Fackler
170c5a5e13 Release tokio-postgres v0.5.5 2020-07-03 15:19:15 -04:00
Steven Fackler
469b72d883
Merge pull request #623 from jakubadamw/geo-types-0_6
Add support for the 0.6 version of `geo_types`.
2020-07-03 15:14:50 -04:00
dependabot-preview[bot]
f5c1902d7d
Update parking_lot requirement from 0.10 to 0.11
Updates the requirements on [parking_lot](https://github.com/Amanieu/parking_lot) to permit the latest version.
- [Release notes](https://github.com/Amanieu/parking_lot/releases)
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.10.0...0.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-24 13:18:13 +00:00
Jakub Wieczorek
5d9acb1eb1 Add support for the 0.6 version of geo_types.
This change drops the support for the 0.5 version by renaming the feature,
as no version of `postgres` with it included has ever been released.
2020-06-24 12:28:21 +02:00
Steven Fackler
3e67dbb773 Fix clippy 2020-06-10 16:54:07 -07:00
Steven Fackler
2b59b7e63c fix clippy 2020-05-25 05:54:19 -07:00
Steven Fackler
e7661fd71f Fix geo-types tests 2020-05-25 05:48:40 -07:00
Jakub Wieczorek
887be86816 Add support for geo-types=0.5
Support for geo-types=0.4 (via the `with-geo-types_04` feature) has been preserved for convenience.
2020-05-25 13:45:17 +02:00
Naim A
a1efddd64a fix typo 2020-05-12 13:48:01 +03:00
Steven Fackler
66f5a8bbc5 Release tokio-postgres v0.5.4 2020-05-01 16:10:41 -07:00
Nathan VanBenschoten
64d6e97eff Re-add savepoint method to Transaction
Revives #184.

The rewrite for async/await and Tokio accidentally lost functionality
that allowed users to assign specific names to savepoints when using
nested transactions. This functionality had originally been added
in #184 and had been updated in #374.

This commit revives this functionality using a similar scheme to the
one that existed before. This should allow CockroachDB users to update
to the next patch release of version `0.17`.
2020-05-01 12:55:48 -04:00
Steven Fackler
fd3a99c225 Don't spawn off connection in blocking impl
We can now directly return fatal errors, and intercept notifications
2020-03-22 12:05:00 -07:00
Michael P. Jung
b10f964a1b Add documentation for crate features
This closes #544
2020-03-16 15:10:25 +01:00
Steven Fackler
72e0dbfcc0 Release tokio-postgres v0.5.3 2020-03-05 17:11:46 -08:00
Steven Fackler
e51028385b Log notices in Connection::poll impl 2020-03-05 15:51:08 -08:00
Steven Fackler
9f6d03d38b Update tokio-util 2020-03-05 05:31:43 -08:00
Aaron Loucks
f33b145cd6 Remove fractional seconds from time_02 tests 2020-02-28 19:30:05 -05:00
Aaron Loucks
25db147e87 Port chrono tests to time tests 2020-02-28 19:03:59 -05:00
Aaron Loucks
2082d4f781 Add support for time-0.2 types 2020-02-28 18:05:51 -05:00
Richard Dodd
6fd69dfd47 Make requested changes 2020-02-17 17:10:51 +00:00
Richard Dodd
369427b381 Allow clippy lint in macro output. 2020-02-17 17:10:51 +00:00
Richard Dodd
51dac3c862 Add Debug impls.
This commit makes the following changes

 - Add an opaque `Debug` impl for `Client`.
 - Add a rich `Debug` impl for `Row`.
 - Make the `Debug` impl for `Type` clearer.
 - Change the `Debug` for `Column` to be slightly neater.
2020-02-17 17:10:51 +00:00
Steven Fackler
4c0ee2c715 Example cleanup 2020-02-09 09:58:18 -08:00
Andreas Runfalk
778f278059 Added information on how to use Vec<T> with Client::query_raw (fixes #567) 2020-02-06 07:49:59 +01:00
Steven Fackler
cc9b8232a8 Release postgres v0.17.1 2020-01-31 18:04:59 -08:00
Steven Fackler
d88bccc27c Release tokio-postgres v0.5.2 2020-01-31 18:00:05 -08:00
Steven Fackler
2ce4f08f46
Merge pull request #564 from benesch/startup-notices
Don't suppress notices during startup flow
2020-01-31 18:24:09 -05:00
Steven Fackler
4bf40cd1d3 Reorder methods 2020-01-31 14:01:16 -08:00
Steven Fackler
27635a20ca Clean up GenericClient traits 2020-01-31 13:59:37 -08:00
Nikhil Benesch
7ea1b2d785
Don't suppress notices during startup flow
NoticeResponses received during the startup flow were previously being
dropped on the floor. Instead stash them away so they can be delivered
to the user after the startup flow is complete.
2020-01-31 00:37:01 -05:00
dvic
5d08af01ec
Remove unnecessary impl GenericClient docs 2020-01-27 15:25:02 +01:00
dvic
1ea8b7b2d4
Fix self references in GenericClient 2020-01-27 11:14:27 +01:00
dvic
afc9b2835d
Add missing methods to GenericClient
This adds `execute_raw`,  `query_one`, `query_opt`, `query_raw`,
and `prepare_typed` to the generic trait introduced in #525.
2020-01-27 10:23:10 +01:00
Steven Fackler
a54ee29704 Allow opt-out of transaction settings
If you changed the default transaction settings of the session, you may
need an explicit opt-out.
2020-01-10 17:49:18 -08:00
Steven Fackler
214413d9dc Add transaction builders
Closes #543
2020-01-08 17:23:28 -08:00
Steven Fackler
24d4b92336 Whitelist clippy lint
async_trait requires this to be explicit
2020-01-02 21:05:38 -05:00
Steven Fackler
3ba416ded6 Add tokio_postgres::GenericClient
We have to make the trait methods differ from the normal methods a bit
by adding Sync + Send bounds to the ToStatement parameter which is a bit
unfortunate, but necessary until GATs async_trait unnecessary.

Closes #357
2020-01-02 21:01:47 -05:00
Steven Fackler
7bd21b492e
Merge pull request #531 from benesch/synchronous-cancel
Support cancellation in synchronous client
2019-12-30 21:09:19 -05:00
Steven Fackler
7e66fa4f7f
Merge pull request #535 from benesch/introspect-config
Expose accessors on Config object
2019-12-30 07:25:13 -08:00
Steven Fackler
850512be8b Remove old dev dependency 2019-12-29 18:42:48 -08:00
Christofer Nolander
8a3edc97de Put unused type parameter back into use 2019-12-29 23:05:45 +01:00
Nikhil Benesch
b73ec018b7
Expose accessors on Config object
Fix #534.
2019-12-29 15:15:48 -05:00
Nikhil Benesch
33dbbcbee7
Support cancellation in synchronous client 2019-12-29 14:08:17 -05:00
Steven Fackler
2093f3e1ee Release tokio-postgres v0.5.1 2019-12-25 08:19:43 -08:00
Nikhil Benesch
6d18d7955e
Remove debugging printlns from copy out protocol 2019-12-25 11:12:55 -05:00
Steven Fackler
1f773f08e3 Release tokio-postgres v0.5.0 2019-12-23 15:40:49 -08:00
Steven Fackler
245ccb7bab Release postgres-types v0.1.0 2019-12-23 15:31:41 -08:00
Steven Fackler
1c5ceebe8a Release postgres-protocol v0.5.0 2019-12-23 15:23:25 -08:00
Steven Fackler
2615441c7d Doc cleanup and "real" extensible enums 2019-12-21 18:14:28 -08:00
Steven Fackler
37d0a83434 remove uuid 0.7 support 2019-12-19 16:41:26 -08:00
Steven Fackler
8ee231f803 Add remaining log statements 2019-12-17 18:11:40 -08:00
Steven Fackler
0e41aea531
Merge pull request #524 from bikeshedder/features/fix-issue-492
Add back logging of queries
2019-12-16 10:42:07 -05:00
Michael P. Jung
d9a999a578 Add back logging of queries
This fixes #492
2019-12-16 14:36:23 +01:00
Steven Fackler
a254e6e9e9 Blocking binary copy support 2019-12-15 17:01:53 -08:00
Steven Fackler
4a5a277878 query_opt test 2019-12-10 16:34:04 -08:00
Steven Fackler
bf8b335d2b Move binary copy stuff directly into main crate 2019-12-08 18:30:47 -08:00
Steven Fackler
0c84ed9f82 rustfmt 2019-12-04 18:59:22 -08:00
Steven Fackler
5c33bf8b30 Don't take parameters in copy_in and copy_out
Postgres doesn't support them, so we may as well not provide the option!

Closes #523
2019-12-04 18:51:59 -08:00
Steven Fackler
a22f63b5bb Fix sqlstate generation 2019-12-02 17:55:08 -08:00
Steven Fackler
b4694471ad Add query_opt
Closes #510
2019-11-30 18:18:50 -05:00
Steven Fackler
299ef6c8dd Rename CopyStream to CopyOutStream 2019-11-30 16:17:23 -05:00
Steven Fackler
ef0b79fbcb docs fix 2019-11-30 11:45:33 -05:00
Steven Fackler
e5e03b0064 Change the copy_in interface
Rather than taking in a Stream and advancing it internally, return a
Sink that can be advanced by the calling code. This significantly
simplifies encoding logic for things like tokio-postgres-binary-copy.

Similarly, the blocking interface returns a Writer.

Closes #489
2019-11-30 11:04:59 -05:00
Steven Fackler
47d97f0d2e Relase tokio-postgres v0.5.0-alpha.2 2019-11-27 20:48:01 -05:00
Steven Fackler
eff68d547f Upgrade parking-lot 2019-11-27 20:42:31 -05:00
Steven Fackler
de2b78dcef Release postgres-types v0.1.0-alpha.2 2019-11-27 20:38:32 -05:00
Steven Fackler
2d083ec1c8 Release postgres-protocol v0.5.0-alpha.2 2019-11-27 20:32:13 -05:00
Steven Fackler
7eb61c786b Fix up benchmark 2019-11-26 16:40:36 -08:00
Steven Fackler
12c2ef79b6 Upgrade to tokio 0.2/futures 0.3 2019-11-26 16:32:36 -08:00
Steven Fackler
5423243923 Make CopyStream !Unpin 2019-11-19 04:29:31 -08:00
Steven Fackler
bccfa83aca Expose CopyOut 2019-11-18 18:39:36 -08:00
Steven Fackler
c98f605622 Switch to pin-project-lite 2019-11-18 18:12:34 -08:00
Steven Fackler
cff1189cda Include column ID in error
Closes #514
2019-11-17 09:17:02 -08:00
Aaron Loucks
2f31e5826d Change connection initialization timezone to UTC 2019-11-16 18:59:39 -05:00
Steven Fackler
ba39e2f53b more example fixes 2019-11-05 11:55:59 -08:00
Steven Fackler
a9f371f70c Clean up tokio-postgres example a bit 2019-11-05 09:56:38 -08:00
Steven Fackler
dc9d07e246 Return a custom TlsStream rather than a ChannelBinding up front 2019-10-27 14:25:58 -07:00
mibac138
9a83196e23 Update dependencies 2019-10-19 20:34:11 +02:00
mibac138
a943a0e666 Support uuid 0.8 2019-10-19 19:52:07 +02:00
Steven Fackler
7a95f6a3e4 pin_mut is in futures now 2019-10-18 22:33:33 -04:00
Steven Fackler
9d2ec747ef Add some simple benchmarks 2019-10-15 18:17:10 -07:00
Steven Fackler
afa466fb25 Release tokio-postgres v0.5.0-alpha.1 2019-10-14 18:14:11 -07:00
Steven Fackler
4745cda7b7 Release postgres-types v0.1.0-alpha.1 2019-10-14 17:56:10 -07:00
Steven Fackler
9ebdca23e1 Release postgres-protocol v0.5.0-alpha.1 2019-10-14 17:46:45 -07:00
Steven Fackler
7b73eee3fb Make streams !Unpin
Hedging against the future if we end up using an intrusive list
implementation
2019-10-14 16:42:54 -07:00
Steven Fackler
e5d2205ce1 Cut out unneeded quotes 2019-10-14 15:13:27 -07:00
Steven Fackler
270371a27a Remove some unused dependencies 2019-10-14 15:07:03 -07:00
Steven Fackler
9e42c67b7b Use the client buffer for cleanup 2019-10-12 18:07:09 -07:00
Steven Fackler
0736382593 Fix tests 2019-10-12 17:47:55 -07:00
Steven Fackler
ffd7245e54 Use BytesMut for messages
Benchmarks indicate that malloc accounts for a significant amount of the
runtime of queries. The message buffer accounts for ~half of that (the
other being channels), and this change should eliminate it.
2019-10-12 16:30:27 -07:00
Steven Fackler
01cc7e4715 Clean up derived code 2019-10-10 16:03:48 -07:00
Steven Fackler
31855141d2 Add query_one 2019-10-09 17:45:53 -07:00
Steven Fackler
8c28f8b363 Overhaul simple_query 2019-10-09 17:04:24 -07:00
Steven Fackler
c7055dc665 Clippy fixes 2019-10-09 15:20:23 -07:00
Steven Fackler
a3f611d609 Overhaul copy_out 2019-10-08 19:01:34 -07:00
Steven Fackler
b8577b45b1 Overhaul query_portal 2019-10-08 17:22:56 -07:00
Steven Fackler
2517100132 Overhaul query
This is the template that we'll use for all other methods taking
parameters. The `foo_raw` variant is the most flexible (but annoying to
use), while `foo` covers the expected common case.
2019-10-08 17:15:41 -07:00
Steven Fackler
0d2d554122 Add a ToStatement trait in tokio-postgres 2019-10-08 19:36:24 -04:00
Steven Fackler
286ecdb5b9 Start on borrow overhaul 2019-10-08 19:34:48 -04:00
Steven Fackler
e0e8c45159 Remove unneeded feature gate 2019-10-08 16:20:30 -07:00
Steven Fackler
3650d4a6de Implement traits for NoTls
Closes #495
2019-10-08 04:25:06 -07:00
Steven Fackler
c92e95dac2 Fix tests 2019-10-07 17:18:00 -07:00
Steven Fackler
4b5bcbb602 Split ToSql/FromSql out to a separate crate
Prep for a `derive` feature.
2019-10-07 17:14:18 -07:00
Steven Fackler
42f1f9675c Update codegen to Postgres 12
They've removed the old header files so some updates were required
2019-10-07 16:37:25 -07:00
Steven Fackler
d8b5412602 Upgrade errcodes to Postgres 12 2019-10-03 18:25:25 -07:00
Steven Fackler
e155af6419 Fix unix socket connection
Closes #491
2019-10-03 18:09:10 -07:00
Steven Fackler
30bd89c524 Upgrade tokio and futures-preview 2019-09-30 18:26:23 -07:00
Steven Fackler
de20f0fcd6 Fix bit-vec-support 2019-09-26 18:31:51 -07:00
Steven Fackler
1c1a939f8a
Merge branch 'master' into master 2019-09-26 21:23:55 -04:00
Steven Fackler
427340d748 Ensure connect future is Send 2019-09-25 18:30:00 -07:00
Steven Fackler
680f7b8ecb Start prepping for futures closing over parameters
Change the slice-consuming methods to requiring &(dyn ToSql + Sync),
which makes the overall value Send. If you have non-Sync values for
whatever reason, you can still use the iterator-based methods.
2019-09-25 18:22:59 -07:00
Steven Fackler
c9469ea826 Simplify logic 2019-09-25 17:59:33 -07:00
Steven Fackler
8079ed6766 Check channel binding requirements when unsupported locally 2019-09-25 17:46:15 -07:00
Steven Fackler
7b230592db Some cleanup 2019-09-25 17:44:45 -07:00
Steven Fackler
6c3a4ab192 Add channel_binding=disable/prefer/require to config
Closes #487
2019-09-24 17:03:37 -07:00
Steven Fackler
e2d305033e Remove vec workaround in tests 2019-09-23 15:57:58 -07:00
Steven Fackler
1fcf026af6 Remove workaround 2019-09-23 15:52:27 -07:00
Steven Fackler
1fa4838717 Upgrade to tokio alpha.5 2019-09-19 14:48:34 -07:00