Thread: opaque function not accepted (without error message)

opaque function not accepted (without error message)

From
"Jules Alberts"
Date:
Hello world,

(postgresql 7.2.1-5 on a completely patched redhat 7.3 box)

In my db I have a function that will be used as a trigger when updating
records.

drop function au_col();
create function au_col()
  returns opaque
  as  'begin
        new.mut_id = current_user;
        new.mut_timestamp = CURRENT_TIMESTAMP;
        return new;
      end;'
  language 'plpgsql';

All seems well, "CREATE" is echoed. Later I found out the function
wasn't in the database, \df in psql doesn't show it. After some
experimenting I found out that apparantly the return type opaque is the
evildoer. When I use an integer type:

drop function au_col();
create function au_col()
  returns integer
  as  'begin
        new.mut_id = current_user;
        new.mut_timestamp = CURRENT_TIMESTAMP;
        return 1;
      end;'
  language 'plpgsql';

the function is created, and \df shows it. Is it impossible to create
an opaque function (according to my books this is quite possible)? Am I
doing something wrong?

TIA for any reactions!

--
Jules Alberts

Re: opaque function not accepted (without error message)

From
"Peter Gibbs"
Date:
Jules Alberts wrote:

> All seems well, "CREATE" is echoed. Later I found out the function
> wasn't in the database, \df in psql doesn't show it. After some
> experimenting I found out that apparantly the return type opaque is the
> evildoer. When I use an integer type:

Note that the \df command does not show functions which return opaque.
--
Peter Gibbs
EmKel Systems



Re: opaque function not accepted (without error message)

From
"Jules Alberts"
Date:
On 13 Aug 2002 at 14:40, Peter Gibbs wrote:
> Jules Alberts wrote:
>
> > All seems well, "CREATE" is echoed. Later I found out the function
> > wasn't in the database, \df in psql doesn't show it. After some
> > experimenting I found out that apparantly the return type opaque is
> > the evildoer. When I use an integer type:
>
> Note that the \df command does not show functions which return opaque.
> -- Peter Gibbs EmKel Systems

Thanks Peter, I didn't know that. Is there any reason why they are not
shown?

--
Jules Alberts.

Re: opaque function not accepted (without error message)

From
Tom Lane
Date:
"Jules Alberts" <jules.alberts@arbodienst-limburg.nl> writes:
>> Note that the \df command does not show functions which return opaque.

> Thanks Peter, I didn't know that. Is there any reason why they are not
> shown?

The idea is to avoid cluttering the display with I/O functions for
datatypes, but I think it's overdoing it.  Sooner or later we're going
to subdivide "opaque" into a set of more crisply-defined
pseudo-datatypes, and maybe then we can make \df smarter about what
not to show.

            regards, tom lane