pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
problem with view/function after upgrade to 7.2
2+ messages / 2 participants
[nested] [flat]

* problem with view/function after upgrade to 7.2
@ 2002-02-12 07:52  juerg.rietmann@pup.ch
  0 siblings, 1 reply; 2+ messages in thread

From: juerg.rietmann@pup.ch @ 2002-02-12 07:52 UTC (permalink / raw)
  To: pgsql-admin

Hello there

After upgrading from 7.0.3 to 7.2 almost everything is up and running !

Except the following function/view is not working. I get an error, saying :
Missing LOOP at end of SQL expression

What has changed here ? Thanks for any help !!

Regards ... jr



CREATE FUNCTION buildString(bpchar)
RETURNS text AS '
DECLARE
     list           text;
     rec          record;
BEGIN
list := '''';
FOR rec IN SELECT z_u_umfang FROM zylinder_umfang WHERE z_u_typ = $1;
     list := list || text(rec.z_u_umfang) || '','';
END LOOP;
RETURN list;
END;'
LANGUAGE 'plpgsql';



CREATE VIEW "viewrzumfang" AS
SELECT rotation.r_code, rotation.r_name, rotation.r_z_typ,
(SELECT zylinder_typen.z_laenge FROM zylinder_typen WHERE
(zylinder_typen.z_typ = rotation.r_z_typ)) AS r_z_laenge,
(SELECT zylinder_typen.z_blaenge FROM zylinder_typen WHERE
(zylinder_typen.z_typ = rotation.r_z_typ)) AS r_z_blaenge,
(SELECT zylinder_typen.z_alaenge_l FROM zylinder_typen WHERE
(zylinder_typen.z_typ = rotation.r_z_typ)) AS r_z_alaenge_l,
(SELECT zylinder_typen.z_alaenge_r FROM zylinder_typen WHERE
(zylinder_typen.z_typ = rotation.r_z_typ)) AS r_z_alaenge_r,
(SELECT rtrim(buildstring(rotation.r_z_typ), ','::text) AS rtrim) AS
r_z_umfang FROM rotation;

__________________________________________________

PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland

internet       :  www.pup.ch
phone          : +4141 790 4040
fax       : +4141 790 2545
mobile         : +4179 211 0315
__________________________________________________




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

* Re: problem with view/function after upgrade to 7.2
@ 2002-02-12 15:08  Tom Lane <tgl@sss.pgh.pa.us>
  parent: juerg.rietmann@pup.ch
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-02-12 15:08 UTC (permalink / raw)
  To: juerg.rietmann@pup.ch; +Cc: pgsql-admin

juerg.rietmann@pup.ch writes:
> Except the following function/view is not working. I get an error, saying :
> Missing LOOP at end of SQL expression

> FOR rec IN SELECT z_u_umfang FROM zylinder_umfang WHERE z_u_typ = $1;
>      list := list || text(rec.z_u_umfang) || '','';
> END LOOP;

Should be
	FOR record | row IN select_query LOOP
	    statements
	END LOOP;
(copied and pasted from the plpgsql documentation...)

			regards, tom lane



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


end of thread, other threads:[~2002-02-12 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-02-12 07:52 problem with view/function after upgrade to 7.2 juerg.rietmann@pup.ch
2002-02-12 15:08 ` 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