The forgotten assignment operator “=” and the commonplace “:=”

后端 未结 4 1449
自闭症患者
自闭症患者 2020-11-22 13:23

The documentation for PL/pgSQL says, that declaration and assignment to variables is done with :=. But a simple, shorter and more modern (see foo

4条回答
  •  爱一瞬间的悲伤
    2020-11-22 13:43

    A partial answer to my own question:

    The PL/pgSQL section Obtaining the Result Status shows two examples using a special syntax:

    GET DIAGNOSTICS variable = item [ , ... ]; 
    GET DIAGNOSTICS integer_var = ROW_COUNT;
    

    I tried both := and = and they work both.

    But GET DIAGNOSTICS is special syntax, so one can argue, that this is also not a normal PL/pgSQL assignment operation.

提交回复
热议问题