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

[DA] Planetscale engine tests: prisma_17103::regression #4480

Open
miguelff opened this issue Nov 21, 2023 · 3 comments
Open

[DA] Planetscale engine tests: prisma_17103::regression #4480

miguelff opened this issue Nov 21, 2023 · 3 comments
Assignees
Labels
topic: driver adapters formerly phase 1

Comments

@miguelff
Copy link
Contributor

miguelff commented Nov 21, 2023

This is a subcluster of failures after having enabled planetscale tests in #4423

Failing tests in this cluster:

new::regressions::prisma_17103::prisma_17103::regression

Please follow this process

@jkomyno
Copy link
Contributor

jkomyno commented Jun 6, 2024

Just did a manual run of new::regressions::prisma_17103::prisma_17103::regression, prisma/prisma#17103 still happens on PlanetScale.
The original issue is closed, but it only referred to MySQL (we didn't support Driver Adapters back then).

In particular, the test new::regressions::prisma_17103::prisma_17103::regression fails with the following error:

Expected 1 records to be connected after connect operation on one-to-many relation 'AToB', found 0.

@jkomyno
Copy link
Contributor

jkomyno commented Jul 24, 2024

Update: new::regressions::prisma_17103::prisma_17103::regression fails even when testing it with relationMode = "foreignKeys":

    #[connector_test(relation_mode = "foreignKeys")]
    async fn regression(runner: Runner) -> TestResult<()> {
        run_query!(
            &runner,
            r#"mutation {
            createOneA(data: { id: 1, b: { create: { id: 1 } } }) {
              id
            }
          }
          "#
        );

        insta::assert_snapshot!(
          run_query!(&runner, r#"mutation { updateOneB(where: { id: 1 }, data: { a: { connect: { id: 1 } } }) { id } }"#),
          @r###"{"data":{"updateOneB":{"id":1}}}"###
        );

        Ok(())
    }

@jkomyno
Copy link
Contributor

jkomyno commented Jul 24, 2024

Update: the problem lies in how the number of affected rows is computed.

When using the mysql Rust driver, we set a special client connection flag, CLIENT_FOUND_ROWS (see PR), which forces MySQL to return the number of rows matching the possibly-implicit WHERE filter in INSERT and UPDATE operations.

Without this, MySQL returns 0 affected row when performing a no-op update, but this breaks the Query Engine expectations when performing nested connects, which expect the update to have had happened already.

Problem: there is no known way of setting client connection flags in PlanetScale. We should reach out to them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: driver adapters formerly phase 1
Projects
None yet
Development

No branches or pull requests

4 participants