Thread: pgAdmin Funciton Code
The code displayed by pgAdmin, for a function I have created, does not allow me to recreate the function as I would like. If I run :- CREATE SCHEMA "Security" AUTHORIZATION postgres; CREATE TABLE "Security"."CentreGroupPolicy" ( "CentreGroupPolicyID" bigint NOT NULL ) WITHOUT OIDS; CREATE OR REPLACE FUNCTION "Security"."CentreGroupPolicyDetailsGet1"(INOUT "pCentreGroupPolicyID" bigint) AS $BODY$ BEGIN SELECT INTO "pCentreGroupPolicyID" cgp."CentreGroupPolicyID" FROM "Security"."CentreGroupPolicy" cgp WHERE cgp."CentreGroupPolicyID" = "pCentreGroupPolicyID"; END; $BODY$ LANGUAGE 'plpgsql' STABLE; Then pgAdmin shows me:- CREATE OR REPLACE FUNCTION "Security"."CentreGroupPolicyDetailsGet1"(INOUT pCentreGroupPolicyID bigint) AS $BODY$ BEGIN SELECT INTO "pCentreGroupPolicyID" cgp."CentreGroupPolicyID" FROM "Security"."CentreGroupPolicy" cgp WHERE cgp."CentreGroupPolicyID" = "pCentreGroupPolicyID"; END; $BODY$ LANGUAGE 'plpgsql' STABLE; Which does not run. If instead I use:- CREATE OR REPLACE FUNCTION "Security"."CentreGroupPolicyDetailsGet1"(INOUT pCentreGroupPolicyID bigint) AS $BODY$ BEGIN SELECT INTO pCentreGroupPolicyID cgp."CentreGroupPolicyID" FROM "Security"."CentreGroupPolicy" cgp WHERE cgp."CentreGroupPolicyID" = pCentreGroupPolicyID; END; $BODY$ LANGUAGE 'plpgsql' STABLE; pgAdmin gives me:- CREATE OR REPLACE FUNCTION "Security"."CentreGroupPolicyDetailsGet1"(INOUT pcentregrouppolicyid bigint) AS $BODY$ BEGIN SELECT INTO pCentreGroupPolicyID cgp."CentreGroupPolicyID" FROM "Security"."CentreGroupPolicy" cgp WHERE cgp."CentreGroupPolicyID" = pCentreGroupPolicyID; END; $BODY$ LANGUAGE 'plpgsql' STABLE; and the case no longer matches for the parameter. Is it possible to make it more consistent?
kenp wrote: > The code displayed by pgAdmin, for a function I have created, does not > allow me to recreate the function as I would like. If I run :- <snip code> Thanks Ken - I've fixed this for 1.6.1. Regards Dave
On 28 Nov 2006 at 8:45, kenp wrote: > SELECT INTO > "pCentreGroupPolicyID" Don't you need to declare pCentreGroupPolicyID first? - .....etc.... $body$ declarepCentreGroupPolicyID bigint; begin......etc.... This would cause the function not to run......what error message did you get? --Ray. ---------------------------------------------------------------------- Raymond O'Donnell Director of Music, Galway Cathedral, Galway, Ireland rod@iol.ie ----------------------------------------------------------------------
On 28 Nov 2006 at 22:06, Raymond O'Donnell wrote: > Don't you need to declare pCentreGroupPolicyID first? - Oops, my mistake - you don't of course, because it's an INOUT parameter. --Ray. ---------------------------------------------------------------------- Raymond O'Donnell Director of Music, Galway Cathedral, Galway, Ireland rod@iol.ie ----------------------------------------------------------------------