473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Confused with LABEL and LOOP

Hi,

I'm a bit confused with the use of Label for loops in PostgreSQL.
I'm using PostgreSQL 8.0 Beta2 version on WIN32 platform.

----------------------------------------------------------------------------
--------
CREATE OR REPLACE FUNCTION TEST( ) RETURNS int4 AS '

BEGIN

<<LOOP1>>
LOOP
Raise Notice ''Loop 1'';

EXIT LOOP1;
END LOOP;

RETURN 0;

END'
LANGUAGE 'plpgsql';
----------------------------------------------------------------------------
--------

When I call SELECT TEST(), I get the error message :
ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "test"

If I just change EXIT LOOP1 to EXIT -> everything is OK
I think we previously had the possibility to indicate the LABEL in EXIT
statement...

Regards,

Patrick

---------------------------------------------------------------------------
----------------
Patrick Fiche
email : pa***********@aqsacom.com
----------------------------------------------------------------------------
---------------


Protected by Polesoft Lockspam
http://www.polesoft.com/refer.html

Nov 23 '05 #1
2 6816
"Patrick Fiche" <pa***********@aqsacom.com> writes:
I'm a bit confused with the use of Label for loops in PostgreSQL.
I'm using PostgreSQL 8.0 Beta2 version on WIN32 platform. CREATE OR REPLACE FUNCTION TEST( ) RETURNS int4 AS '
BEGIN
<<LOOP1>>
LOOP
Raise Notice ''Loop 1'';
EXIT LOOP1;
END LOOP;
RETURN 0;
END'
LANGUAGE 'plpgsql'; When I call SELECT TEST(), I get the error message :
ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "test"


Hmm. I think this *should* work, and experimentation shows that it did
work up through PG 7.2. It's broken in 7.3 and later.

Jan, do you see any fine point that makes this function wrong? Sure
looks like a bug to me.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
Tom Lane <tg*@sss.pgh.pa.us> writes:
"Patrick Fiche" <pa***********@aqsacom.com> writes:
I'm a bit confused with the use of Label for loops in PostgreSQL.
Sure looks like a bug to me.


Ah-hah: it's a case-sensitivity problem. The <<>> construct downcases
its label identifier, but EXIT forgets to do so. Spell it as
"EXIT loop1" and you'll be OK.

I'll fix this for 8.0.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Capstar | last post by:
Hi NG, I'm trying to allocate some resources, in this example a structure, with containing a buffer. When a allocation failes, all previous allocations need to be freed. When I try to compile it...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
by: kaiser | last post by:
Hello, Am new to C# and am playing around trying to get a while loop to display a int on a windows console using label. private void btnGo_Click(object sender, System.EventArgs e) { int Counter...
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
13
by: Marvin | last post by:
Hi: I have been programming with OOP and C++ for over 10 years but I am new to javascript. I am very confused about one aspect and would appreciate it if someone could explain the differences...
13
by: AKHTAR ALI | last post by:
Dear Sir, i am reading a text file line by line from vb and insert in oracle table through pl/sql procedure. in text file record is 70000, in my code i make a loop to read data in loop and...
4
by: Jeff | last post by:
Hi all, For some reason, this seems to fail for me (it's psuedo-code): for(var i=0; i<length; i++) { for(var j=0; j<length; j++) { ... if(condition) { break my_label; }
10
by: anon.asdf | last post by:
Here's a reminder of duff's device: /*************************************/ #include <stdio.h> #define STEP 8 #define MAX_LEN STEP*4+1 #define SOURCE_LEN 28
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.