Thread: sql question after upgrade

sql question after upgrade

From
"James Cooper"
Date:

Hi just upgraded to 7.3.2 and imported my db schema with no probs!

Just wondering... why VOLATILE is being appended to my functions - can anyone ansewer me what this means? - should i be using joins instead, does this make a difference? If so an example of this would be much appreciated!!

CREATE FUNCTION public.get_people_total(int4) RETURNS int8 AS '
select count(person_id) as total from person where person_id IN
(
select cp.person_id from cluster_person cp, cluster c where cp.cluster_id = c.cluster_id and c.c_id = $1 group by cp.person_id
);
' LANGUAGE 'sql' VOLATILE;

 

cheers all

James

Re: sql question after upgrade

From
Neil Conway
Date:
On Sat, 2003-02-22 at 19:58, James Cooper wrote:
> Just wondering... why VOLATILE is being appended to my functions - can
> anyone ansewer me what this means?

http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/sql-createfunction.html

explains the meaning of IMMUTABLE, STABLE, and VOLATILE.

Cheers,

Neil
-- 
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC





Re: sql question after upgrade

From
Peter Eisentraut
Date:
James Cooper writes:

> Just wondering... why VOLATILE is being appended to my functions - can
> anyone ansewer me what this means?

Read the reference page for CREATE FUNCTION and then decide whether it's
appropriate for your functions.  Old functions get it appended during the
dump because that is how the function was effectively treated in the
version you are dumping from, but you may choose to take advantage of the
finer granularity that is now available.

-- 
Peter Eisentraut   peter_e@gmx.net