Re: Why? - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: Why?
Date
Msg-id Pine.BSF.4.10.10008271320510.47595-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Why?  (Juan Carlos Perez Vazquez <cray2@mail.com>)
List pgsql-hackers
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.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: signed, volatile, etc
Next
From: "Mitch Vincent"
Date:
Subject: Re: [SQL] queries and inserts