| From: | Sebastian Kühner <support(at)veraza(dot)com> |
|---|---|
| To: | <pgsql-admin(at)postgresql(dot)org> |
| Subject: | LOOP and EXIT |
| Date: | 2005-07-12 17:49:00 |
| Message-ID: | 00c601c58709$fce8d560$6501a8c0@oper2 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
Hello,
I'm new here in this group... and I hope that I find the solution for my
problem here.
I wrote a simple function which looks like this:
CREATE OR REPLACE FUNCTION watchdog() RETURNS TIME AS '
DECLARE
watchdog_control RECORD;
help RECORD;
BEGIN
LOOP
PERFORM * FROM watchdog_ctl;
IF NOT FOUND THEN
EXIT;
END IF;
PERFORM sleep(3);
END LOOP;
RETURN now();
END;
' LANGUAGE plpgsql;
That means that I want to leave the loop if there isn't an entry in the
table watchdog_ctl. This works fine if the table is empty at the startup of
the function (select watchdog();). But if I empty the table watchdog_ctl
while the function is running it seems to be an endless loop. Hay anyone of
you an idea why??
Many thanks!
Sebastian
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thanh Q Lam | 2005-07-12 18:59:27 | How to list user accounts? |
| Previous Message | Colton Smith | 2005-07-12 13:56:06 | query concerning vacuum and tablespaces |