Обсуждение: Re: [HACKERS] NULL as an argument in plpgsql functions (fwd)

Поиск
Список
Период
Сортировка

Re: [HACKERS] NULL as an argument in plpgsql functions (fwd)

От
Oleg Bartunov
Дата:
Excuse me for reposting,

I just want to be sure my original posting doesn't lost.
Is this a bug or feature ?
Also, it seems there is a  limitation to a number of arguments.

    Regards,
            Oleg

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

---------- Forwarded message ----------
Date: Mon, 27 Sep 1999 15:26:08 -0400 (EDT)
From: Bruce Momjian <maillist@candle.pha.pa.us>
To: Oleg Bartunov <oleg@sai.msu.su>
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [HACKERS] NULL as an argument in plpgsql functions

> Hi,
>
> this select produces error message:
> test=> select test2(NULL);
> ERROR:  typeidTypeRelid: Invalid type - oid = 0
>

Not sure how to pass NULL's into functions.


> test2:
> CREATE FUNCTION test2 (int4) RETURNS int4 AS '
> Declare
>     keyval      Alias For $1;
>     cnt         int4;
> Begin
>   Update hits set count = count +1  where msg_id = keyval;
>   return cnt;
> End;
> ' LANGUAGE 'plpgsql';
>
> When I do manually update
> Update hits set count = count +1  where msg_id = NULL;
> it works fine. What's the problem ?
>
>     Regards,
>
>         Oleg
>
>
> test=> \d hits
> Table    = hits
> +----------------------------------+----------------------------------+-------+
> |              Field               |              Type                | Length|
> +----------------------------------+----------------------------------+-------+
> | msg_id                           | int4                             |     4 |
> | count                            | int4                             |     4 |
> +----------------------------------+----------------------------------+-------+
> test=> select version();
> version
> ------------------------------------------------------------------
> PostgreSQL 6.5.2 on i586-pc-linux-gnulibc1, compiled by gcc 2.95.1
> (1 row)
>
> _____________________________________________________________
> Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> Sternberg Astronomical Institute, Moscow University (Russia)
> Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> phone: +007(095)939-16-83, +007(095)939-23-83
>
>
> ************
>


--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] NULL as an argument in plpgsql functions (fwd)

От
Tom Lane
Дата:
Oleg Bartunov <oleg@sai.msu.su> writes:
> Is this a bug or feature ? 

It's a bug.  Fixing it will require a wholesale code revision, however
(see my prior postings about redesigning the function call interface).

This is something we need to do for 6.6, IMHO, not only because of
the NULL-argument issue but also because it will solve the portability
problems that are being created by the existing fmgr interface (Alpha
bugs, need to dumb down to -O0 on some platforms, etc).  I've been
trying to summon the will to get started on it, but other things keep
getting in the way...

> Also, it seems there is a  limitation to a number of arguments.

Yes, 8.  I'm not planning to do anything about that in the near term.
Even just making the limit configurable would be a lot of work :-(
        regards, tom lane


Re: [HACKERS] NULL as an argument in plpgsql functions (fwd)

От
Oleg Bartunov
Дата:
Thanks Tom for explanation. I'm giving up :-)
Will wait ... Just surprised how many things are covered from 
casual glimpse.
It seems that Perl is the only panacea for all kind of problem.

BTW, I think this bug must be written in documentation so people
will not spent time as me or at leaset in release notices.
Regards,
    Oleg

On Wed, 29 Sep 1999, Tom Lane wrote:

> Date: Wed, 29 Sep 1999 09:55:15 -0400
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: Oleg Bartunov <oleg@sai.msu.su>
> Cc: pgsql-hackers@postgreSQL.org
> Subject: Re: [HACKERS] NULL as an argument in plpgsql functions (fwd) 
> 
> Oleg Bartunov <oleg@sai.msu.su> writes:
> > Is this a bug or feature ? 
> 
> It's a bug.  Fixing it will require a wholesale code revision, however
> (see my prior postings about redesigning the function call interface).
> 
> This is something we need to do for 6.6, IMHO, not only because of
> the NULL-argument issue but also because it will solve the portability
> problems that are being created by the existing fmgr interface (Alpha
> bugs, need to dumb down to -O0 on some platforms, etc).  I've been
> trying to summon the will to get started on it, but other things keep
> getting in the way...
> 
> > Also, it seems there is a  limitation to a number of arguments.
> 
> Yes, 8.  I'm not planning to do anything about that in the near term.
> Even just making the limit configurable would be a lot of work :-(
> 
>             regards, tom lane
> 
> ************
> 

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83