Thread: Function problem -- how do I drop this function?
I have created the following procedure (using phpPgAdmin -- which is very buggy). When I try to drop it using 'drop function CreateUser();', I am told it does not exist. If I try using 'drop function CreateUser(varchar(12), varchar(12), varchar(30), char(1), varchar(30), varchar(30), boolean)', I am told it does not exist either. If I try it from phpPgAdmin, I get this error; "PostgreSQL said: ERROR: parser: parse error at or near "varying" Your query: DROP FUNCTION "CreateUser"(character,varying,,character,varying,,character,varying,,charac ter,,character,varying,,character,varying,,boolean) ". So, is there no way to drop this function? CREATE FUNCTION CreateUser(varchar(12), varchar(12), varchar(30), char(1), varchar(30), varchar(30), boolean) RETURNS int4 AS ' DECLARE id int4; un ALIAS FOR $1; pw ALIAS FOR $2; fn ALIAS FOR $3; mi ALIAS FOR $4; ln ALIAS FOR $5; ea ALIAS FOR $6; a ALIAS FOR $7; BEGIN SELECT id = nextval('users_id_seq'); INSERT INTO users (id, username, password, firstname, middleinitial, lastname, emailaddr, admin) VALUES (id, un, pw, fn, mi, ln, ea, ad); RETURN id; END ' LANGUAGE 'plpgsql'; Thanks, Tom Veldhouse veldy@veldy.net
Thomas, DROP FUNCTION CREATEUSER; should suffice I believe. -Knight On Tue, 26 Jun 2001, Thomas T. Veldhouse wrote: > I have created the following procedure (using phpPgAdmin -- which is very > buggy). When I try to drop it using 'drop function CreateUser();', I am > told it does not exist. If I try using 'drop function > CreateUser(varchar(12), varchar(12), varchar(30), char(1), varchar(30), > varchar(30), boolean)', I am told it does not exist either. If I try it > from phpPgAdmin, I get this error; > > "PostgreSQL said: ERROR: parser: parse error at or near "varying" > Your query: > DROP FUNCTION > "CreateUser"(character,varying,,character,varying,,character,varying,,charac > ter,,character,varying,,character,varying,,boolean) > ". > > So, is there no way to drop this function? > > CREATE FUNCTION CreateUser(varchar(12), varchar(12), varchar(30), char(1), > varchar(30), varchar(30), boolean) RETURNS int4 AS ' > DECLARE > id int4; > un ALIAS FOR $1; > pw ALIAS FOR $2; > fn ALIAS FOR $3; > mi ALIAS FOR $4; > ln ALIAS FOR $5; > ea ALIAS FOR $6; > a ALIAS FOR $7; > BEGIN > SELECT id = nextval('users_id_seq'); > INSERT INTO users (id, username, password, firstname, middleinitial, > lastname, emailaddr, admin) > VALUES (id, un, pw, fn, mi, ln, ea, ad); > RETURN id; > END ' LANGUAGE 'plpgsql'; > > Thanks, > > Tom Veldhouse > veldy@veldy.net > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
you have to name all the args as well: DROP FUNCTION CREATEUSER(varchar,varchar,varchar,car,varchar,varchar,boolean); should work. cheers, thalis On Tue, 26 Jun 2001, Alex Knight wrote: > Thomas, > > DROP FUNCTION CREATEUSER; should suffice I believe. > > -Knight > > On Tue, 26 Jun 2001, Thomas T. Veldhouse wrote: > > > I have created the following procedure (using phpPgAdmin -- which is very > > buggy). When I try to drop it using 'drop function CreateUser();', I am > > told it does not exist. If I try using 'drop function > > CreateUser(varchar(12), varchar(12), varchar(30), char(1), varchar(30), > > varchar(30), boolean)', I am told it does not exist either. If I try it > > from phpPgAdmin, I get this error; > > > > "PostgreSQL said: ERROR: parser: parse error at or near "varying" > > Your query: > > DROP FUNCTION > > "CreateUser"(character,varying,,character,varying,,character,varying,,charac > > ter,,character,varying,,character,varying,,boolean) > > ". > > > > So, is there no way to drop this function? > > > > CREATE FUNCTION CreateUser(varchar(12), varchar(12), varchar(30), char(1), > > varchar(30), varchar(30), boolean) RETURNS int4 AS ' > > DECLARE > > id int4; > > un ALIAS FOR $1; > > pw ALIAS FOR $2; > > fn ALIAS FOR $3; > > mi ALIAS FOR $4; > > ln ALIAS FOR $5; > > ea ALIAS FOR $6; > > a ALIAS FOR $7; > > BEGIN > > SELECT id = nextval('users_id_seq'); > > INSERT INTO users (id, username, password, firstname, middleinitial, > > lastname, emailaddr, admin) > > VALUES (id, un, pw, fn, mi, ln, ea, ad); > > RETURN id; > > END ' LANGUAGE 'plpgsql'; > > > > Thanks, > > > > Tom Veldhouse > > veldy@veldy.net > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
Been a while since I've dropped a function :) On Tue, 26 Jun 2001, Thalis A. Kalfigopoulos wrote: > you have to name all the args as well: > > DROP FUNCTION CREATEUSER(varchar,varchar,varchar,car,varchar,varchar,boolean); > > should work. > > cheers, > thalis > > > On Tue, 26 Jun 2001, Alex Knight wrote: > > > Thomas, > > > > DROP FUNCTION CREATEUSER; should suffice I believe. > > > > -Knight > > > > On Tue, 26 Jun 2001, Thomas T. Veldhouse wrote: > > > > > I have created the following procedure (using phpPgAdmin -- which is very > > > buggy). When I try to drop it using 'drop function CreateUser();', I am > > > told it does not exist. If I try using 'drop function > > > CreateUser(varchar(12), varchar(12), varchar(30), char(1), varchar(30), > > > varchar(30), boolean)', I am told it does not exist either. If I try it > > > from phpPgAdmin, I get this error; > > > > > > "PostgreSQL said: ERROR: parser: parse error at or near "varying" > > > Your query: > > > DROP FUNCTION > > > "CreateUser"(character,varying,,character,varying,,character,varying,,charac > > > ter,,character,varying,,character,varying,,boolean) > > > ". > > > > > > So, is there no way to drop this function? > > > > > > CREATE FUNCTION CreateUser(varchar(12), varchar(12), varchar(30), char(1), > > > varchar(30), varchar(30), boolean) RETURNS int4 AS ' > > > DECLARE > > > id int4; > > > un ALIAS FOR $1; > > > pw ALIAS FOR $2; > > > fn ALIAS FOR $3; > > > mi ALIAS FOR $4; > > > ln ALIAS FOR $5; > > > ea ALIAS FOR $6; > > > a ALIAS FOR $7; > > > BEGIN > > > SELECT id = nextval('users_id_seq'); > > > INSERT INTO users (id, username, password, firstname, middleinitial, > > > lastname, emailaddr, admin) > > > VALUES (id, un, pw, fn, mi, ln, ea, ad); > > > RETURN id; > > > END ' LANGUAGE 'plpgsql'; > > > > > > Thanks, > > > > > > Tom Veldhouse > > > veldy@veldy.net > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 5: Have you checked our extensive FAQ? > > > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >