Re: Parse error help needed...

From: "Thapliyal, Deepak" <dthapliyal(at)soe(dot)sony(dot)com>
To: 'Larry Rosenman' <ler(at)lerctr(dot)org>, 'PostgreSQL General' <pgsql-general(at)postgresql(dot)org>
Subject: Re: Parse error help needed...
Date: 2004-01-13 01:39:32
Message-ID: 1FE5193EE2768D478949FC0AFBFFC43B06EBDE0B@mail-sd1.station.sony.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Now my function is created ... Thanks guys ..

Now getting error while trying to execute it

postgres=# select loadme();
WARNING: Error occurred while executing PL/pgSQL function loadme
WARNING: line 7 at SQL statement
ERROR: SPI_prepare() failed on "commit"

Thx again
Deep

PS: here is fn definition

create function loadme() returns text as '
Declare
s_out text ;
Begin
For i in 1..10000 loop
insert into test values (i,''Test'');
end loop;
commit;
returns s_out;
End;
' language 'plpgsql';

-----Original Message-----
From: Larry Rosenman [mailto:ler(at)lerctr(dot)org]
Sent: Monday, January 12, 2004 5:29 PM
To: Thapliyal, Deepak; 'PostgreSQL General'
Subject: Re: [GENERAL] Parse error help needed...

--On Monday, January 12, 2004 17:24:14 -0800 "Thapliyal, Deepak"
<dthapliyal(at)soe(dot)sony(dot)com> wrote:

> Made the change and used returns in both places now .. Gives me error
>
> postgres=# \i a.sql
> psql:a.sql:10: ERROR: language "plpgsql" does not exist
>
createlang plpgsql

> Any help is appreciated
>
> Thx
> Deep
>
> create function loadme() returns text as '
> Declare
> s_out text ;
> Begin
> For i in 1..10000 loop
> insert into test values (i,''Test'');
> end loop;
> returns s_out;
> End;
> ' language 'plpgsql';
>
>
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Alex Satrapa
> Sent: Monday, January 12, 2004 4:57 PM
> To: PostgreSQL General
> Subject: Re: [GENERAL] Parse error help needed...
>
>
> Thapliyal, Deepak wrote:
>> create function loadme() return text as '
>
> try "RETURNS" instead of "RETURN"
>
> [the guys writing the function parser might want to consider reporting
> what the parser was expecting at this point]
>
>> Declare
>> s_out text ;
>> Begin
>> For i in 1..10000 loop
>> insert into test values (i,''Test'');
>> end loop;
>> return s_out;
>> End;
>> ' language 'plpgsql';
>
> The rest looks fine (works for me - yes I tested it this time)
>
> Alex Satrapa
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

Responses

Browse pgsql-general by date

  From Date Subject
Next Message D. Dante Lorenso 2004-01-13 02:24:10 Re: Drawbacks of using BYTEA for PK?
Previous Message Jim Wilson 2004-01-13 01:33:10 Re: Column qualifier issue