Skip to content
  • Steinar H. Gunderson's avatar
    aa79a622
    WL #12131: Deprecate setting user variables within expressions · aa79a622
    Steinar H. Gunderson authored
    MySQL has an SQL extension called user variables, where the user can do
    something like
    
      SET @a := 3;
      SELECT @a + 123;
    
    However, it also allows setting these variables within expressions:
    
      SELECT (@a := @a + 1) + 456;
    
    Given that SQL does not contain any notion of sequence points, the timing of
    when these variables are set is undefined. Furthermore, since they can change
    _type_ at any time, semantics can become extremely confusing and/or
    undefined, and it's been the source of a number of bugs.
    
    The most popular use of such assignments is to simulate windowing functions
    (e.g. row_number()), but now, we have true windowing functions.
    
    Thus, deprecate it, staging it for later removal.
    
    Change-Id: Ic6aa9bca2c4cb39ed8fa292401745b06fa42265c
    aa79a622
    WL #12131: Deprecate setting user variables within expressions
    Steinar H. Gunderson authored
    MySQL has an SQL extension called user variables, where the user can do
    something like
    
      SET @a := 3;
      SELECT @a + 123;
    
    However, it also allows setting these variables within expressions:
    
      SELECT (@a := @a + 1) + 456;
    
    Given that SQL does not contain any notion of sequence points, the timing of
    when these variables are set is undefined. Furthermore, since they can change
    _type_ at any time, semantics can become extremely confusing and/or
    undefined, and it's been the source of a number of bugs.
    
    The most popular use of such assignments is to simulate windowing functions
    (e.g. row_number()), but now, we have true windowing functions.
    
    Thus, deprecate it, staging it for later removal.
    
    Change-Id: Ic6aa9bca2c4cb39ed8fa292401745b06fa42265c
Loading