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

Compatibility Issue with Prisma ORM #581

Closed
NOT-HAL9000 opened this issue Jan 11, 2023 · 6 comments · Fixed by #586 or #579
Closed

Compatibility Issue with Prisma ORM #581

NOT-HAL9000 opened this issue Jan 11, 2023 · 6 comments · Fixed by #586 or #579

Comments

@NOT-HAL9000
Copy link

NOT-HAL9000 commented Jan 11, 2023

Trying to see if Prisma can be used with PGAdapter and Cloud Spanner. Getting the following error. Trying to understand if this is a Prisma or PGAdapter problem. Thanks!

Error querying the database: db error: ERROR: Invalid SET statement: SET NAMES 'UTF8'. Expected TO or =.

Referenced Discussion and reproducibility steps on Prisma Repo here: prisma/prisma#717 (comment)

@olavloite
Copy link
Collaborator

Thanks for reaching out. We have not yet tested Prisma with PGAdapter, so we can't make any statements on how well/bad it will work with Prisma.

This specific issue however is a PGAdapter problem. The SET NAMES 'UTF8' syntax is not a standard PostgreSQL statement, but it is something that PostgreSQL apparently has added support for to adhere to the ANSI SQL standard. See https://www.postgresql.org/docs/current/multibyte.html. PGAdapter currently does not take that possibility into account.

@NOT-HAL9000
Copy link
Author

Thanks for the response.

I wasn't aware of this and had wrongly assumed that Prisma may have been accidentally sending mysql commands based on some quick google searches.

I noticed this project doesn't accept pull requests. Could I submit compatibility with Prisma as a feature request?

@olavloite
Copy link
Collaborator

I noticed this project doesn't accept pull requests.

Hmm.... Maybe it's time to update that part of the documentation. Let me check with a couple of other people as well.

Could I submit compatibility with Prisma as a feature request?

Certainly!

@NOT-HAL9000
Copy link
Author

Certainly!

Would love to see a popular type-safe typescript ORM get Spanner compatibility!


FYI, I tried SET NAMES 'UTF8' in both the DDL and Query editors and both returned an error. I'm not sure if this is because the spanner console runs a PGAdapter in the background which fails for the same reason.

DDL Editor:
Screen Shot 2023-01-12 at 12 58 03 am

QUERY Editor:
Screen Shot 2023-01-12 at 12 56 36 am

@janpio
Copy link

janpio commented Jan 11, 2023

Hey, Prisma here 👋

Amazing to see this issue, and how @NOT-HAL9000 is pushing forward to figure out what is standing in the way of Prisma and Google Cloud Spanner (via PgAdapter) to work together (they mentioned it in our issue prisma/prisma#717 (comment)).

Might it be as simple as accepting SET NAME 'UTF8' in the adapter and swallowing it instead of forwarding it (for now)?

As we are currently basically just trying to find the real blockers down the line (which probably will be other, not supported queries), if someone (*hint @NOT-HAL9000 *hint 😆) opens a PR is there a simple way to test that code/adapter locally?

olavloite added a commit that referenced this issue Jan 12, 2023
PostgreSQL supports the alias `set names '<value>'` for setting the client
encoding. This is an alias for `set client_encoding to '<value>'`.

Fixes #581
@olavloite
Copy link
Collaborator

@NOT-HAL9000 I've created #589 for the more generic request to add support for Prisma, so we can treat this issue as a specific issue with the set names ... statement.

olavloite added a commit that referenced this issue Jan 18, 2023
PostgreSQL supports the alias `set names '<value>'` for setting the client
encoding. This is an alias for `set client_encoding to '<value>'`.

Fixes #581
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants