Commit Graph

430 Commits

Author SHA1 Message Date
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
Steven Fackler
5283ad4a08 Clean up workaround 2019-09-19 14:45:15 -07:00
Steven Fackler
b7fe6bece5 Update to newest nightly 2019-09-11 22:20:22 -04:00
Steven Fackler
08a163c546 Fix doc link 2019-09-08 16:54:57 -07:00
Steven Fackler
42cf855168 Include the Rust type name in WrongType 2019-09-06 04:37:26 -07:00
Jeb Rosen
98fb1173f5 Make prepare() return a Future that satisfies Send. 2019-09-03 18:44:30 -07:00
Steven Fackler
2a2b76d1b8 Upgrade to tokio alpha.4 2019-08-29 18:10:58 -07:00
Steven Fackler
c026644820 async_await is stable on nightly now 2019-08-21 07:48:36 -04:00
Steven Fackler
aa44090fad Update futures-preview/tokio 2019-08-18 09:02:21 -04:00
Steven Fackler
92e3d013eb Update to released tokio 2019-08-10 20:25:12 -07:00
Steven Fackler
3ed4543426 Don't block the reactor on DNS 2019-08-04 19:21:32 -07:00
Steven Fackler
f07ebc7373 Support nested transactions 2019-08-03 18:25:28 -07:00
Steven Fackler
2311ceac41 Cleanup shutdown call 2019-08-03 18:11:22 -07:00
Steven Fackler
f5a8b1de68 Update postgres 2019-08-03 18:09:27 -07:00
Steven Fackler
2a97c20bf2 Clean up old test 2019-08-02 20:31:15 -07:00
Steven Fackler
048e91a57d Use flush combinator 2019-08-02 20:30:36 -07:00
Steven Fackler
26a17ac4ed Support portals 2019-08-01 20:43:13 -07:00
Steven Fackler
e4a1ec23a1 Fix impl ordering 2019-08-01 18:44:38 -07:00
Steven Fackler
760039627a Fix build without the runtime feature 2019-08-01 18:43:38 -07:00
Steven Fackler
785205ffb2 Finish documenting everything 2019-08-01 18:40:14 -07:00
Steven Fackler
5dccb9988a Test notifications 2019-07-31 21:19:56 -07:00
Steven Fackler
e521e3b0a5 Transaction::copy_out 2019-07-31 20:16:07 -07:00
Steven Fackler
9c178ad816 Support copy_out 2019-07-31 20:15:17 -07:00
Steven Fackler
81bc845bcf Simplify logic a bit 2019-07-31 19:44:16 -07:00
Steven Fackler
beb509f3f3 rustfmt 2019-07-30 21:29:18 -07:00
Steven Fackler
f45884711f Support copy_in 2019-07-30 21:25:30 -07:00
Steven Fackler
4afd5235db Transaction support 2019-07-30 19:54:30 -07:00
Steven Fackler
88399a790c Cancel query support 2019-07-29 21:36:07 -07:00
Steven Fackler
9d851f6727 Fix doc examples 2019-07-29 18:55:11 -07:00
Steven Fackler
6fac2186ce
Fix Windows build? 2019-07-29 15:17:45 -07:00
Steven Fackler
00ef0bfd84 Use smoke_test for target_session_attrs_ok 2019-07-28 17:50:46 -07:00
Steven Fackler
dea6c3ebc5 Fix target_session_attrs handling 2019-07-28 17:48:32 -07:00
Steven Fackler
9938ffff1a Test and fix simple_query 2019-07-28 16:34:07 -07:00
Steven Fackler
07e5930ddb Handle target_session_attrs 2019-07-28 16:02:34 -07:00
Steven Fackler
e77b0fd009 Add simple_query and batch_execute 2019-07-28 15:52:46 -07:00
Steven Fackler
51f02c89ee Fully working prepare 2019-07-28 09:26:04 -07:00
Kai Yao
2c43519093 Updated bitvec to 0.6.1, as it supports serde serialization/deserialization. 2019-07-27 21:07:03 -05:00
Steven Fackler
4396f38fcc Setup socket 2019-07-25 07:21:53 -07:00
Steven Fackler
77caff91ef Add query/select 2019-07-24 21:28:52 -07:00
Steven Fackler
90eb58dc8e Some prep for custom type lookup 2019-07-23 20:16:31 -07:00
Steven Fackler
f9e46510ba Implement prepare 2019-07-23 19:54:22 -07:00
Steven Fackler
2480fefd2c Connection IO logic 2019-07-22 21:27:21 -07:00
Steven Fackler
32fe52490e Runtime connect 2019-07-22 20:17:29 -07:00
Steven Fackler
89501f66d9 Start on std::futures rewrite
connect_raw works!
2019-07-21 21:44:43 -07:00
Steven Fackler
d91f9d8407 gut tokio-postgres 2019-07-21 16:09:45 -07:00
Steven Fackler
8192c771c0 Add methods that take iterators of parameters
The existing methods which take slices of parameters work well when
directly passing a temporary slice (e.g. `c.query(s, &[&15, &"hi"])`,
but becomes limiting in other contexts like when programmatically
building up a query. We now offer methods which take iterators, which
are significantly more flexible for these kinds of use cases.

Because of the weird object safety of `ToSql`, we can't be generic over
`Iterator<Item = impl ToSql>`, but instead have to specifically work
with `Iterator<Item = &dyn ToSql>`. This may require a `.map()` or two
but should still work fine.

Closes #265
2019-07-09 19:00:10 -07:00
Steven Fackler
904c951ad6 Release postgres v0.16.0-rc.2 2019-06-29 21:43:50 -07:00
Steven Fackler
310f0ebfc6 Release tokio-postgres v0.4.0-rc.3 2019-06-29 21:18:28 -07:00
Steven Fackler
47d83d57a0 Release postgres-protocol v0.4.1 2019-06-29 21:06:23 -07:00
Steven Fackler
e760d82f64 Drop tokio- prefix from TLS crates
They're way too wordy and used with both tokio-postgres and postgres
anyway.
2019-06-29 16:07:56 -07:00
Steven Fackler
3f264027c9 Fix some typos 2019-06-29 12:32:46 -07:00
Steven Fackler
2d2a5dea81 Send response messages in blocks
Our codec implementation originally just parsed single messages out of
the stream buffer. However, if a query returns a bunch of rows, we're
spending a ton of time shipping those individual messages from the
connection back to the Query stream. Instead, collect blocks of unparsed
messages that are as large as possible and send those back.

This cuts the processing time of the following query in half, from ~10
seconds to ~5:
`SELECT s.n, 'name' || s.n FROM generate_series(0, 9999999) AS s(n)`

At this point, almost all of the remainder of the time is spent parsing
the rows.

cc #450
2019-06-27 21:47:13 -07:00
Steven Fackler
9dbeb849f8 rustfmt 2019-06-25 19:20:59 -07:00
Steven Fackler
db462eb018 Avoid copies in copy_in
copy_in data was previously copied ~3 times - once into the copy_in
buffer, once more to frame it into a CopyData frame, and once to write
that into the stream.

Our Codec is now a bit more interesting. Rather than just writing out
pre-encoded data, we can also send along unencoded CopyData so they can
be framed directly into the stream output buffer. In the future we can
extend this to e.g. avoid allocating for simple commands like Sync.

This also allows us to directly pass large copy_in input directly
through without rebuffering it.
2019-06-25 18:54:17 -07:00
Steven Fackler
4a5d30b4c6 Buffer copy_in messages
Otherwise there's a ton of overhead passing tons of tiny messages over
channels.
2019-06-22 21:22:03 -07:00
Steven Fackler
d8842982b0 Include the parameter/column index in type conversion errors
Closes #442
2019-05-20 19:05:54 -07:00
Steven Fackler
1270524df2 Fix new clippy warnings 2019-04-11 19:51:42 -07:00
Steven Fackler
0c8ecc0240 Release postgres v0.16.0-rc.1 2019-04-06 20:59:01 -07:00
Steven Fackler
956ba12b54 Conversions from INET to IpAddr
We ignore the netmask when deserializing and use /32 or /128 when
serializing.

Closes #430
2019-04-03 21:30:49 -07:00
Steven Fackler
6c0ec6a6bf TLS docs for tokio-postgres 2019-04-01 21:56:25 -07:00
Steven Fackler
1cbf9a1b8d Fix build 2019-03-10 16:39:10 -07:00
Steven Fackler
3b31551f73 Upgrade fallible-iterator 2019-03-10 16:32:28 -07:00
Steven Fackler
374fadb816 Release tokio-postgres-openssl v0.1.0-rc.1 2019-03-06 21:05:04 -08:00
Steven Fackler
4f084e7b64 Release tokio-postgres v0.4.0-rc.2 2019-03-05 21:49:54 -08:00
Steven Fackler
e549f8d635 Fix features 2019-03-05 21:47:34 -08:00
Steven Fackler
4174eeeecb Release tokio-postgres v0.4.0-rc.1 2019-03-05 21:35:46 -08:00
Steven Fackler
9385bebefc Release postgres-protocol v0.4.0 2019-03-05 19:09:48 -08:00
Steven Fackler
9e4f4d3496 More clippy 2019-03-05 18:26:55 -08:00
Steven Fackler
23b83e5153 Upgrade state-machine-future 2019-03-04 22:24:51 -08:00
Steven Fackler
269197f743 Fix build 2019-03-04 22:22:51 -08:00
Steven Fackler
1f80b78f07 Adjust API layout 2019-03-04 21:51:44 -08:00
Steven Fackler
31534b5734 Fix serde docs 2019-03-04 21:51:44 -08:00
Steven Fackler
1d3c540dd9 Fix serde docs 2019-03-04 21:26:10 -08:00
Steven Fackler
07c7ffdac6 Finish docs for tokio-postgres 2019-03-04 21:22:50 -08:00
Steven Fackler
d35139dac9 Fix ToSql/FromSql docs 2019-03-04 20:30:57 -08:00
TheSandwichMakr
5dd9bb5eab
move Debug from Inner to Config, use Formatter::debug_struct 2019-02-20 03:03:25 +00:00
TheSandwichMakr
4bde7d2e3c
Omit passwords from debug output 2019-02-19 23:23:42 +00:00
Steven Fackler
fb6e19ae60 Use geo-types rather than geo
Closes #418
2019-02-17 12:34:17 -08:00
Steven Fackler
7e0f10de0b Cleanups 2019-02-01 20:45:25 -08:00
Steven Fackler
fa3241e6b5 Fix geo feature 2019-01-31 21:28:04 -08:00
Steven Fackler
756121ed62 cleanup 2019-01-31 20:59:33 -08:00
Steven Fackler
48af741192 Add a simple_query test 2019-01-31 20:47:42 -08:00