Skip to content

Cannot set variable in mysql #822

Closed Answered by FelixZY
FelixZY asked this question in Q&A
Mar 25, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Ok, I found the issue: Apparently, @var <> NULL is not supported. Instead, @var IS NOT NULL must be used instead.

Testing like this:

-- Deploy app:variable_test to mysql
begin;

SELECT
  sqitch.checkit (
    EXISTS (
      SELECT
        *
      FROM
        performance_schema.user_variables_by_thread
      WHERE
        variable_name = 'hello'
    ),
    'No such variable'
  );

SELECT
  sqitch.checkit (
    EXISTS (
      SELECT
        *
      FROM
        performance_schema.user_variables_by_thread
      WHERE
        variable_name = 'hello'
        AND variable_value = 'world'
    ),
    'No such variable'
  );

SELECT
  sqitch.checkit (@hello IS NOT NULL, 'Variable is NULL');

SELECT

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@FelixZY
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by FelixZY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants