Re: problem with pl/pgsql function unknown parameters

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Jules Alberts <jules(dot)alberts(at)arbodienst-limburg(dot)nl>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: problem with pl/pgsql function unknown parameters
Date: 2003-02-12 17:09:23
Message-ID: 3E4A7FC3.1010004@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

>
>
>select is_empty();
>ERROR: Function 'is_empty()' does not exist
>Unable to identify a function that satisfies the given argument types
>You may need to add explicit typecasts
>
>
Yeah... as I said below - you need a separate function for that...

>
>Defensive programming. I want my functions to behave nicely, even if
>they have no idea what's coming at them. If a function gets no
>parameter, it could default to a hardcoded value. IMO this is very
>useful, I find it strange that postgresql doesn't allow this.
>
>
>
>Another example of a useful function (semi-code):
>
>function showtype(unspecified) returns text {
> raise notice ''%'', datatype($1);
>}
>
>I guess that if I wanted to do this in postgresql I would have to make
>a function for every possible datatype. Not very efficient :-(
>
>
This is a question of taste (or ideology, if you would)...
Some language use strict types, some do not. For example, in perl or
javascript, or (to a lesser extent) in Kernigan-Richie C you can do all
kinds of tricks like that, in ANSI C, or C++ or Java you cannot... It
looks like stored procedures in postgres follow the latter paradigm...
There are some advantages, and some disadvantages to that, the consencus
among computer scientists nowadays seems to be that advantages are worth
the lost flexibility....

Dima

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Joel Lopez 2003-02-12 18:06:29 psql: FATAL 1: IDENT authentication failed for user "phpuser"
Previous Message Scott Morrison 2003-02-12 14:15:57 Re: view users