Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pure postgres #2375

Closed
wants to merge 2 commits into from
Closed

Conversation

martell
Copy link
Contributor

@martell martell commented Apr 24, 2020

Just trying to trigger ci when updating #2257 to master

@weiznich
Copy link
Member

As already stated in in #2257 we currently do not have the bandwidth to work on this change, therefore at least I won't look into this at least till the diesel 2.0 release.

Generally speaking it should be possible to extract the Connection definition into a third party crate and use it from there. I'm not even sure if that's the better solution for the long run. (Again that's something that should be (and will be) discussed after the diesel 2.0 release.)

@martell
Copy link
Contributor Author

martell commented Apr 25, 2020

Hey, I totally understand. I was just trying to update the work you put into this up to master.
I'll be looking to see #2376 get merged and then will probably revisit the github ci support so that I can do this in a fork a lot more easily.
Maybe when I am done here it can be merged back into your PR, and we will revisit everything after 2.0. And thanks and for taking the time to reply to my various PRs :)

@weiznich
Copy link
Member

@martell I really appreciate the work you've already done in various PR's here, so a big THANKS for that 👍. Getting the github CI branch up do date and working would be great.
For the grand scheme of things, especially about diesel 2.0: In my opinion that thing that slows me down is having to review all of the PR's on my own. Having a second eye at least on API additions, unsafe code and documentation changes would be great help there and should speed up things a bit. If you are interested it that I just can add you into the diesel reviewer team so that you get notifications on corresponding pings.

@martell
Copy link
Contributor Author

martell commented May 2, 2020

I'd be glad to help out where ever I can, though it might be intermittent based on work life schedule, and I might only be able to give feedback on some things for lack of context :)

@weiznich
Copy link
Member

weiznich commented May 2, 2020

I've sent you an invitation. Beside of that to clarify a few things:

though it might be intermittent based on work life schedule

It's totally fine to have a real life. Just drop me a message as soon as you run out of time for this and I will remove you from the corresponding team again.

I might only be able to give feedback on some things for lack of context :)

As we have already written in other places (especially #1186) it's totally fine not to understand everything. In fact you are encouraged to ask questions whenever something is unclear, also things that are not directly related to the code/PR you are reviewing.

use postgresql::error::SqlState;

if let Some(code) = e.code() {
let kind = if *code == SqlState::UNIQUE_VIOLATION {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably implement the From trait in a different file for these
I added the missing mappings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've put everything in one file back then, because that made development easier. If you find a good location for this, that would be great.

fn establish(database_url: &str) -> ConnectionResult<Self> {
use postgresql::tls::NoTls;

let client = postgresql::Client::connect(database_url, NoTls)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we handle tls vs no tls, a feature flag ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I would assume NoTLS for the generic establish method. For using the Tls support from the postgres crate (or any other connection specific stuff from there) there is a TryFrom<postgres::Client> impl somewhere, so that you can construct a customized connection on your own.

#[allow(missing_debug_implementations)]
pub struct PgConnection {
pub(crate) raw_connection: RawConnection,
conn: RefCell<postgresql::Client>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a large_enum_variant which makes clippy unhappy.
Suggestions ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wrapping the inner connection into a box should make clippy happy here.

@martell
Copy link
Contributor Author

martell commented Jul 9, 2020

as_changeset::option_fields_are_assigned_null_when_specified hangs on windows
need to look into that at some point.

@weiznich
Copy link
Member

as_changeset::option_fields_are_assigned_null_when_specified hangs on windows
need to look into that at some point.

It's not clear why this should even happen. If you are sure that's a permanent issue and not a temporary CI issue, it may be worth reporting that with corresponding reproducing code to the upstream postgres crate.

@weiznich
Copy link
Member

Closed as this is currently not planed as part of diesel. I encourage interested users to publish such a connection implementation as third party crate for now. After such a crate reaches a stable state we can talk about upstreaming parts of that work into diesel.

@weiznich weiznich closed this Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants