Re: problem with pl/pgsql function unknown parameters - Mailing list pgsql-novice

From Dmitry Tkach
Subject Re: problem with pl/pgsql function unknown parameters
Date
Msg-id 3E4A7FC3.1010004@openratings.com
Whole thread Raw
In response to Re: problem with pl/pgsql function unknown parameters  ("Jules Alberts" <jules.alberts@arbodienst-limburg.nl>)
List 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


pgsql-novice by date:

Previous
From: "Scott Morrison"
Date:
Subject: Re: view users
Next
From: "Joel Lopez"
Date:
Subject: psql: FATAL 1: IDENT authentication failed for user "phpuser"