Re: problem with pl/pgsql function unknown parameters
От | Dmitry Tkach |
---|---|
Тема | Re: problem with pl/pgsql function unknown parameters |
Дата | |
Msg-id | 3E4A7FC3.1010004@openratings.com обсуждение исходный текст |
Ответ на | Re: problem with pl/pgsql function unknown parameters ("Jules Alberts" <jules.alberts@arbodienst-limburg.nl>) |
Список | 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 по дате отправления: