Problems with plpgsql and FOR loops - Mailing list pgsql-general

From Bill Moran
Subject Problems with plpgsql and FOR loops
Date
Msg-id 40341DA9.8070706@potentialtech.com
Whole thread Raw
Responses Re: Problems with plpgsql and FOR loops  ("V i s h a l Kashyap @ [Sai Hertz And Control Systems]" <sank89@sancharnet.in>)
Re: Problems with plpgsql and FOR loops  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I've got a bit of a strange problem that's causing me some MAJOR
headaches.

I'm developing the server-side of a large database application in
PostgreSQL.  This consists of a C daemon, and a LOT of stored
functions in the database.

I'm developing this in conjunction with another company, who is
developing the the client side.  I've got a 7.4 server that I'm
developing on, and once a day I push my changes up to a common
server that the client developers can use to test and work with.

That server is the problem, it's running 7.3.4 and I'm not in a
position to upgrade it in the near future.

Some of the plpgsql functions I've created work fine on 7.4, but
fail on 7.3.4.  Specifically, when I use a "FOR var IN select LOOP"
loop with a LONG select statement, it works fine on 7.4, but
bonks with "missing .. at end of SQL expression" in 7.3.4

I know the correct solution is to use the same version to develop
on that I'm using to test.  So I'm going to downgrade my version
to 7.3.4 for now ... but this doesn't solve my biggest problem:
getting the FOR loop to work.  It appears from the error that
the parser is getting confused between a FOR IN SELECT loop and
a FOR integer loop.

Does anyone have any suggestions on how to convince the parser
to interpret the loop correctly?  This is a MAJOR holdup for
me right now, and I'm on a tight schedule, so any help will be
a life-saver!

I've been unable to subscribe to the list, so please include me
in your reply directly.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com


pgsql-general by date:

Previous
From: jack_turer@yahoo.com (jack turer)
Date:
Subject: pg_dump and pg_dumpall fail when trying to backup database
Next
From: Linh Luong
Date:
Subject: finding out actual tuple size