Re: Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?

From: Nick <nboutelier(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?
Date: 2010-09-12 06:52:19
Message-ID: 7fd5be50-b279-4233-aa39-7fe9e5afc067@q40g2000prg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Woops, figured it out. Just needed to declare the num_var := '';

On Sep 11, 10:45 pm, Nick <nboutel(dot)(dot)(dot)(at)gmail(dot)com> wrote:
> CREATE FUNCTION test() RETURNS text
>     LANGUAGE plpgsql
>     AS $$DECLARE
>   num_var TEXT;
> BEGIN
>   FOR i IN 1..10 LOOP
>     num_var := num_var || ',' || i;
>   END LOOP;
>   RETURN num_var;
> END;$$;
>
> SELECT test();
>
> returns NULL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Casey Jones 2010-09-12 06:53:56 Huge amount of memory errors with libpq
Previous Message sunpeng 2010-09-12 06:39:42 Fwd: how to write the sql if i want to find a geometry's d-distance neighbors?