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

add nullability info to Describe, fix bad "unknown type" errors in query!() #108

Closed
wants to merge 35 commits into from

Conversation

abonander
Copy link
Collaborator

@abonander abonander commented Feb 6, 2020

This is a subset of #88 that we can push in a patch release:

  • add nullability info to Describe
    • Since describe::Column is marked #[non_exhaustive] the new field is a backwards-compatible addition.
  • query pg_attribute to get non-null columns in Postgres and pg_type to get type names

While I was at it I fixed the "unknown type" error being useless for query!() params and columns since for Postgres it needed to fetch the type info anyway.

Closes #107
Closes #17

@abonander abonander force-pushed the ab/describe-nullability branch 3 times, most recently from 35e5a6b to b14c45b Compare February 6, 2020 03:05
@abonander abonander force-pushed the ab/describe-nullability branch 3 times, most recently from ed13e07 to 93f4302 Compare February 6, 2020 03:35
@abonander abonander changed the title add nullability info to Describe add nullability info to Describe, fix bad "unknown type" errors in query!() Feb 6, 2020
@abonander abonander force-pushed the ab/describe-nullability branch 2 times, most recently from b57992c to 7d234e4 Compare February 6, 2020 05:27
@abonander abonander force-pushed the ab/describe-nullability branch 2 times, most recently from 4feb50e to f762013 Compare February 14, 2020 21:34
type_,
i + 1,
)
.into()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! This will probably help a lot of folks. Easy to forget to add feature flags.

Copy link
Contributor

@thedodd thedodd left a comment

Choose a reason for hiding this comment

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

Awesome! One small issue with the TEXT[] bit, but other than that, lgtm!

mehcode and others added 8 commits February 21, 2020 15:11
 * Allow `conn.fetch(" ... ")` to be called where `conn` is an owned Connection
 * Executor::fetch -> RefExecutor::fetch_by_ref
 * Executor::fetch_by_ref -> Executor::fetch
 * Move `Connection::describe` to `Executor::describe`
 * `Transaction` is no longer a `Connection`
 * `Connection` has `Executor` as a super-trait again which greatly simplifies bounds
mehcode and others added 23 commits February 29, 2020 17:11
implement nullability check for Postgres as a query on pg_attribute

implement type name fetching for Postgres as part of `describe()`

add nullability for describe() to MySQL

improve errors with unknown result column type IDs in `query!()`

run cargo fmt and fix warnings

improve error when feature gates for chrono/uuid types is not turned on

workflows/rust: add step to UI-test missing optional features

improve error for unsupported/feature-gated input parameter types

fix `PgConnection::get_type_names()` for empty type IDs list

fix `tests::mysql::test_describe()` on MariaDB 10.4

copy-edit unsupported/feature-gated type errors in `query!()`

Postgres: fix SQL type of string array

Co-Authored-By: Anthony Dodd <Dodd.AnthonyJosiah@gmail.com>
@abonander
Copy link
Collaborator Author

Rebased onto develop.

@abonander abonander closed this Mar 3, 2020
@abonander abonander deleted the ab/describe-nullability branch March 3, 2020 04:26
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.

Weird compiler error when using some MySQL types Better error message for unsupported types in query!
3 participants