Skip site navigation (1) Skip section navigation (2)

using = in a function

From: Andy Colson <andy(at)squeakycode(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: using = in a function
Date: 2008-01-28 22:18:43
Message-ID: 479E54C3.2090201@squeakycode.net (view raw or flat)
Thread:
Lists: pgsql-general
Hi all,

I was reading the doc's on functions when I came across this:

"
An assignment of a value to a PL/pgSQL variable or row/record field is 
written as:

variable := expression;
"

and I realized, I didn't do that!  My assignments look like:

tmp = extract(minute from result);
if tmp > 30 then
	tmp = 60 - tmp;
	offset = tmp || ' minutes';
	result = result + offset;
else
	offset = tmp || ' minutes';
	result = result - offset;
end if;


Notice I just use = and not :=.

My question is, is there a difference?  It seems to work both ways, so 
I'm a little confused.

Thanks,

-Andy

Responses

pgsql-general by date

Next:From: John GateleyDate: 2008-01-28 22:26:04
Subject: Re: Table has duplicate keys, what did I do
Previous:From: Jeremy HarrisDate: 2008-01-28 22:17:27
Subject: enabling autovacuum

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group