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

DRIVER_ADAPTERS_BRANCH=fix-adapter-neon-adapter-pg-treat-all-custom-types-as-text #4531

Conversation

aqrln
Copy link
Member

@aqrln aqrln commented Dec 7, 2023

Run tests for prisma/prisma#22239

@aqrln aqrln added this to the 5.8.0 milestone Dec 7, 2023
Copy link

codspeed-hq bot commented Dec 7, 2023

CodSpeed Performance Report

Merging #4531 will not alter performance

Comparing prisma/fix-adapter-neon-adapter-pg-treat-all-custom-types-as-text (feb5c6e) with main (12d71c4)

Summary

✅ 11 untouched benchmarks

aqrln added a commit to prisma/prisma that referenced this pull request Dec 8, 2023
 Treat all custom Postgres types as text in the result set.

This is an alternative to #21918.

Thanks to driver adapters using Postgres text protocol, unlike our native driver that uses the binary protocol, we can get away with treating all unknown extension types as text if we want to expose them to users as such — we (or the driver) don't need to know how to decode them and convert to strings if they are already strings in the first place.

However, we cannot distinguish between known types added by extensions and enums without querying the catalog for type names. This may look like a problem at first, but in reality we can get away with treating enums as text in result set too, the response IR layer in the query engine uses the query schema to know it's an enum, not the type hint that comes from `quaint::Value`/`PrismaValue`. If the output type in the query schema says it's an enum, it will treat `PrismaValue::String` and `PrismaValue::Enum` equally: https://github.com/prisma/prisma-engines/blob/12d71c4263690f3990d590fbff611b2a24ef2dbc/query-engine/core/src/response_ir/internal.rs#L813. So mapping Postgres enums to `quaint::ValueType::Text` is fine, and is already supported by QE.

Engines test suite passing: prisma/prisma-engines#4531

Fixes: #21807
Closes: #21918

Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com>
@aqrln aqrln closed this Apr 9, 2024
@aqrln aqrln deleted the prisma/fix-adapter-neon-adapter-pg-treat-all-custom-types-as-text branch April 9, 2024 23:05
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.

1 participant