Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In PL/PgSQL parser, assignment operator is defined as </p> <pre><code>assign_operator : '=' | COLON_EQUALS ; </code></pre> <p>This is a legacy feature, present in source code since 1998, when it was introduced - as we can see in the <a href="http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=863a62064cfc2b706dd6ab45487d15cc33cedb35" rel="nofollow noreferrer">PostgreSQL Git repo</a>.</p> <p>Starting from version 9.4 it is <a href="https://www.postgresql.org/docs/9.4/static/plpgsql-statements.html" rel="nofollow noreferrer">oficially documented</a>.</p> <p>This idiosyncrasy - of having two operators for same thing - was raised on pgsql users list, and some people requested it to be removed, but it's still kept in the core because fair corpus of legacy code relies on it.</p> <p>See this <a href="http://archives.postgresql.org/pgsql-bugs/2011-08/msg00140.php" rel="nofollow noreferrer">message from Tom Lane (core Pg developer)</a>.</p> <p>So, to answer your questions straight:</p> <blockquote> <p>Didn't I find some section in the docs which mention and/or explains this?</p> </blockquote> <p>You did not find it because it was undocumented, which is fixed as of version 9.4.</p> <blockquote> <p>Are there any known consequences using = instead of :=.</p> </blockquote> <p>There are no side consequences of using <strong>=</strong>, but you should use <strong>:=</strong> for assignment to make your code more readable, and (as a side effect) more compatible with PL/SQL.</p> <p>Update: there may be a side consequence in rare scenarios (see Erwin's answer) </p> <hr> <p>UPDATE: answer updated thanks to input from Daniel, Sandy &amp; others. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload