Re: Why?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Juan Carlos Perez Vazquez <cray2(at)mail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why?
Date: 2000-08-27 20:25:19
Message-ID: Pine.BSF.4.10.10008271320510.47595-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

  • Why? at 2000-08-27 11:19:44 from Juan Carlos Perez Vazquez

Browse pgsql-hackers by date

  From Date Subject
Next Message Mitch Vincent 2000-08-27 22:01:02 Re: queries and inserts
Previous Message Tom Lane 2000-08-27 20:13:40 signed, volatile, etc