-1

What does the := operator mean in SQL? I am using Postgresql and I have no idea what it means. I have this code :

DECLARE
  i RECORD;
  q TEXT[];
  cfg_rec RECORD;
BEGIN
  SELECT * FROM xxx_private.function() INTO cfg_rec;
  q:=q || cfg_rec.q;
moodymudskipper
  • 42,696
  • 10
  • 102
  • 146
beniaminp
  • 350
  • 1
  • 3
  • 8

1 Answers1

5

:= isn't an SQL operator. It's a PL/pgSQL operator (similar syntax can be found in PL1, Oracle's PL/SQL and even Pascal). Anyway, this is the assignment operator. In your case, it appends cfg_rec.q to the previous value of q (the || operator), and then assigns it back to the q variable you defined in the declare block.

Mureinik
  • 277,661
  • 50
  • 283
  • 320