Skip to content

Instantly share code, notes, and snippets.

@pschultz
Created April 15, 2013 10:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pschultz/5387172 to your computer and use it in GitHub Desktop.
Save pschultz/5387172 to your computer and use it in GitHub Desktop.
Postgresql function after ALTER SCHEMA public RENAME to public_copy;
CREATE OR REPLACE FUNCTION public.get_locations()
RETURNS SETOF public.locations AS
$BODY$
DECLARE
l_record public.locations;
BEGIN
FOR l_record IN
SELECT * FROM public.locations
ORDER BY location_desc
LOOP
RETURN NEXT l_record;
END LOOP;
END;
$BODY$
LANGUAGE plpgsql VOLATILE SECURITY DEFINER
COST 10
ROWS 10;
CREATE OR REPLACE FUNCTION public_copy.get_locations()
RETURNS SETOF public_copy.locations AS
$BODY$
DECLARE
l_record public.locations;
BEGIN
FOR l_record IN
SELECT * FROM public.locations
ORDER BY location_desc
LOOP
RETURN NEXT l_record;
END LOOP;
END;
$BODY$
LANGUAGE plpgsql VOLATILE SECURITY DEFINER
COST 10
ROWS 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment