pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL TO-DO List (fwd)
4+ messages / 3 participants
[nested] [flat]

* PostgreSQL TO-DO List (fwd)
@ 2002-03-04 02:55  Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 2 replies; 4+ messages in thread

From: Bruce Momjian @ 2002-03-04 02:55 UTC (permalink / raw)
  To: pgsql-docs

Can someone comment on this?  I don't understand it.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@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
Hi! Bruce,

Many thanks to your great contributions to Pgsql
projects.

I cannot find the following to-fix bug in section
"SERVER-SIDE LANGUAGES" in "PostgreSQL TO-DO List".

Please also refer to:
"Example 23-4. A PL/pgSQL Function on Composite Type"
in integrated on-line document.

Best Regards,

CN

=========================
create table test(f1 integer,f2 integer);
CREATE FUNCTION fun1(test) RETURNS BOOLEAN AS '
DECLARE
  f1 FOR $1.f1;
  f2 FOR $1.f2;
  integer sum;
BEGIN
  sum:=f1+f2;
  raise notice ''f1+f2'',sum;
  RETURN TRUE;
END;' LANGUAGE 'plpgsql';
-----------------------
CREATE FUNCTION fun2() RETURNS OPAQUE AS '
BEGIN
  PERFORM fun1(NEW);
  RETURN NEW;
END;' LANGUAGE 'plpgsql';

CREATE TRIGGER ttest AFTER INSERT ON test FOR EACH
ROW EXECUTE PROCEDURE fun2();
insert into test values(1,2);


NOTICE:  Error occurred while executing PL/pgSQL
function fun2
NOTICE:  line 2 at assignment
ERROR:  NEW used in non-rule query

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL TO-DO List (fwd)
@ 2002-03-07 15:24  Vince Vielhaber <vev@michvhf.com>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 1 reply; 4+ messages in thread

From: Vince Vielhaber @ 2002-03-07 15:24 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-docs

On Sun, 3 Mar 2002, Bruce Momjian wrote:

> Can someone comment on this?  I don't understand it.
>
>

The example being referred to is here:

http://www.us.postgresql.org/users-lounge/docs/7.2/postgres/plpgsql-examples.html

Scroll to the bottom.  Unfortunately I can't go back and read his
comment with the terminal I'm using.

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
         56K Nationwide Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL TO-DO List (fwd)
@ 2002-03-07 16:51  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2002-03-07 16:51 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-docs

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Can someone comment on this?  I don't understand it.

He's complaining that a whole-row reference to NEW doesn't work
in a plpgsql trigger.  He's right.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL TO-DO List (fwd)
@ 2002-03-07 19:02  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Vince Vielhaber <vev@michvhf.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2002-03-07 19:02 UTC (permalink / raw)
  To: Vince Vielhaber <vev@michvhf.com>; +Cc: pgsql-docs

Vince Vielhaber wrote:
> On Sun, 3 Mar 2002, Bruce Momjian wrote:
> 
> > Can someone comment on this?  I don't understand it.
> >
> >
> 
> The example being referred to is here:
> 
> http://www.us.postgresql.org/users-lounge/docs/7.2/postgres/plpgsql-examples.html
> 
> Scroll to the bottom.  Unfortunately I can't go back and read his
> comment with the terminal I'm using.

The current query in this section is:
	
	CREATE FUNCTION c_overpaid (EMP, INTEGER) RETURNS BOOLEAN AS '
	    DECLARE
	        emprec ALIAS FOR $1;
	        sallim ALIAS FOR $2;
	    BEGIN
	        IF emprec.salary ISNULL THEN
	            RETURN ''f'';
	        END IF;
	        RETURN emprec.salary > sallim;
	    END;
	' LANGUAGE 'plpgsql';

Looks OK to me.  Seems it has been updated since the report.  I can't
find a mention of fun1 or fun2 anywhere in the docs anymore.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-03-07 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-03-04 02:55 PostgreSQL TO-DO List (fwd) Bruce Momjian <pgman@candle.pha.pa.us>
2002-03-07 15:24 ` Vince Vielhaber <vev@michvhf.com>
2002-03-07 19:02   ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-03-07 16:51 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox