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

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] NULL as an argument in plpgsql functions
Date: 1999-09-28 08:19:22
Message-ID: Pine.GSO.3.96.SK.990928115218.16613H-100000@ra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 27 Sep 1999, Bruce Momjian wrote:

> Date: Mon, 27 Sep 1999 15:26:08 -0400 (EDT)
> From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
> To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
> Cc: pgsql-hackers(at)postgreSQL(dot)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.

I'm unable to pass NULL also to sql function not only
to plpgsql one. I don't see any reason for this :-)
I'm wondering if I'm the only have this problem.

Regards,

Oleg

>
>
> > 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(at)sai(dot)msu(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ansley, Michael 1999-09-28 08:39:18 Latest tree
Previous Message Zakkr 1999-09-28 07:26:12 Re: [HACKERS] _text problem in union