Skip to content
  • Guilhem Bichot's avatar
    68168613
    Rephrased warning message to be more informative: from · 68168613
    Guilhem Bichot authored
    Setting user variables within expressions is deprecated and will be
    removed in a future release. Please set variables in separate statements
    instead.
    to
    Setting user variables within expressions is deprecated and will be
    emoved in a future release. Consider alternatives:
    'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
    The advantage of the new message is in this situation:
    select @a:=<expr1>, @b:=<expr2> from complex_query ;
    "Separate statements", as in the original warning, implicitely
    suggests to use SET, and thus a subquery; as SET only supports scalar
    subqueries it yields:
    SET @a:=(SELECT <expr1> from complex_query),
        @a:=(SELECT <expr2> from complex_query);
    which is inefficient (runs complex_query twice); a better and simpler
    rewrite is:
    SELECT <expr1>, <expr2> INTO @a,@b from complex_query,
    as suggested by the new message.
    68168613
    Rephrased warning message to be more informative: from
    Guilhem Bichot authored
    Setting user variables within expressions is deprecated and will be
    removed in a future release. Please set variables in separate statements
    instead.
    to
    Setting user variables within expressions is deprecated and will be
    emoved in a future release. Consider alternatives:
    'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
    The advantage of the new message is in this situation:
    select @a:=<expr1>, @b:=<expr2> from complex_query ;
    "Separate statements", as in the original warning, implicitely
    suggests to use SET, and thus a subquery; as SET only supports scalar
    subqueries it yields:
    SET @a:=(SELECT <expr1> from complex_query),
        @a:=(SELECT <expr2> from complex_query);
    which is inefficient (runs complex_query twice); a better and simpler
    rewrite is:
    SELECT <expr1>, <expr2> INTO @a,@b from complex_query,
    as suggested by the new message.
Loading