Giter Club home page Giter Club logo

Comments (6)

weiznich avatar weiznich commented on June 1, 2024

Thanks for filling this PR. Can you clarify if that's a CockroachDB specific feature or if that's something that could happen with other backends as well? In the first case it's just a matter of using a not officially supported database which does not support all required features, which is something that should be fixed in that database system or by providing a third party backend/connection implementation.

from diesel.

50U10FCA7 avatar 50U10FCA7 commented on June 1, 2024

@weiznich SET CLUSTER SETTING is CockroachDB specific feature, but the case of executing a single statement as batch in diesel migrations is misleading imho.

from diesel.

weiznich avatar weiznich commented on June 1, 2024

Well, as a migration can and will contain several statements in general it's the only meaningful solution to use batch_execute for this, as otherwise we would need to have a full sql parsers to detect if a migration is a single or multiple statements. That's clearly out of scope for this project, especially if that is related to an feature of a not supported backend.

from diesel.

50U10FCA7 avatar 50U10FCA7 commented on June 1, 2024

@weiznich The problem is also related to supported backends I think:

For example if I turn off multi-statement execution in MySQL (MYSQL_OPTION_MULTI_STATEMENTS_OFF) and try to run migrations contains single statements only I will get an error.

as otherwise we would need to have a full sql parsers to detect if a migration is a single or multiple statements.

Multiple statements separates with ; in most cases, isn't it enough to detect multi-statement queries?

p.s. Or maybe just run a query as single-statement, and if error occurs - run as batch?

from diesel.

weiznich avatar weiznich commented on June 1, 2024

Multiple statements separates with ; in most cases, isn't it enough to detect multi-statement queries?

That will not work for queries like UPDATE some_table SET foo = ';'

For example if I turn off multi-statement execution in MySQL (MYSQL_OPTION_MULTI_STATEMENTS_OFF) and try to run migrations contains single statements only I will get an error.

Given that this is not the default I do not see that as critical problem. We likely would accept a PR that improves the handling of such situations by just enforcing that this option is not set.

from diesel.

50U10FCA7 avatar 50U10FCA7 commented on June 1, 2024

@weiznich Ok, got your point. 👌

Closing the issue, due the problem is out of project scope.

from diesel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.