:= sql operator in pgsql function

8.5k views Asked by At

I came across this operator := in a postgresql function:

searchsql:= searchsql || ' WHERE 1=1 ' ;

I googled but cannot find the answer, what does it mean?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

:= is the assignment operator in PL/pgSQL

The expression

searchsql:= searchsql || ' WHERE 1=1 ' ;

appends the string ' WHERE 1=1 ' to the current value of the variable searchsql

See the manual for details:
http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT