Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E884D6500EE for ; Fri, 11 Jul 2008 13:57:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 73783-02 for ; Fri, 11 Jul 2008 13:56:55 -0300 (ADT) X-Greylist: delayed 00:30:50.7999 by SQLgrey-1.7.6 Received: from mail.socialserve.com (office.socialserve.com [208.60.89.34]) by postgresql.org (Postfix) with ESMTP id 95942650587 for ; Fri, 11 Jul 2008 13:56:56 -0300 (ADT) Received: from dynamic-99.socialserve.com (dynamic-99.socialserve.com [10.1.1.99]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.socialserve.com (Postfix) with ESMTP id 405EA13F748 for ; Fri, 11 Jul 2008 12:25:34 -0400 (EDT) Message-Id: <52962000-14ED-4BC2-8F5D-520F238FA78D@socialserve.com> From: James Robinson To: pgsql-docs@postgresql.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v926) Subject: plpgsql, declare blocks, and '=' versus ':=' Date: Fri, 11 Jul 2008 12:25:35 -0400 X-Mailer: Apple Mail (2.926) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/2 X-Sequence-Number: 4933 It seems that [ in 8.2.9 at least ], in a plpgsql declare block, assignment to declared variable can use either the proper ':=' operator or the unexpected and undocumented '=' operator. See following script. The magic handling of '=' ought to get documented at least. [ plpgsql-declarations.html makes no mention of '=' token handling in either 8.3 or 8.2. docs ] --- create or replace function test_1() returns int as $$ declare value int = 12; -- wow -- no colon! begin return value; end; $$ language plpgsql; create or replace function test_2() returns int as $$ declare value int := 14; -- correct begin return value; end; $$ language plpgsql; select test_1(); -- returns 12 select test_2(); -- returns 14 ----- ---- James Robinson Socialserve.com