Why?
Why?
От:
Juan Carlos Perez Vazquez <cray2@mail.com>
Дата:
Hi! Why does not work this? CREATE FUNCTION PWDCHG () RETURNS OPAQUE AS ' BEGIN ALTER USER utest WITH PASSWORD ''ptest''; END; ' LANGUAGE 'plpgsql'; select PWDCHG(); ERROR: typeidTypeRelid: Invalid type - oid = 0 and this other? CREATE FUNCTION PWDCHG () RETURNS bool AS ' BEGIN ALTER USER utest WITH PASSWORD ''ptest''; RETURN ''t''; END; ' LANGUAGE 'plpgsql'; select PWDCHG(); ERROR: copyObject: don't know how to copy 646 Regards, Juan Carlos. ______________________________________________ FREE Personalized Email at Mail.com Sign up at http://www.mail.com/?sr=signup
Re: Why?
От:
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Дата:
On Sun, 27 Aug 2000, Juan Carlos Perez Vazquez wrote: > Hi! > > Why does not work this? > > CREATE FUNCTION PWDCHG () RETURNS OPAQUE AS ' > BEGIN > ALTER USER utest WITH PASSWORD ''ptest''; > END; > ' LANGUAGE 'plpgsql'; > > select PWDCHG(); > ERROR: typeidTypeRelid: Invalid type - oid = 0 You don't select functions that have return type OPAQUE. Think of functions returning opaque as procedures that cannot be called in a context where their return value is used. Plus, the utility commands aren't fully implemented in plpgsql in 7.0 (more below) > and this other? > > CREATE FUNCTION PWDCHG () RETURNS bool AS ' > BEGIN > ALTER USER utest WITH PASSWORD ''ptest''; > RETURN ''t''; > END; > ' LANGUAGE 'plpgsql'; > > select PWDCHG(); > ERROR: copyObject: don't know how to copy 646 In 7.0 most of the utility commands are not available in plpgsql. They should be available in 7.1. I don't know if any of the other pl languages had utility commands that worked in 7.0 (I don't know tcl and didn't compile pl/perl), but that's another possibility for how to do it.