From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | suresh(at)cse(dot)iitb(dot)ac(dot)in |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Writing a user defined function |
Date: | 2008-07-20 15:22:59 |
Message-ID: | 162867790807200822pb662d6ahaf1681e8fae739df@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
2008/7/20 Suresh <suiyengar(at)yahoo(dot)com>:
> Hello,
>
> Version is 8.1.3. Its an older version, in which I have some custom code.
> I want to test the code with a function which has a seq scan and a blocking
> loop.
>
first, scrollable cursors are supported from 8.3
second, you cannot declare cursor inside block - see on plpgsql documentation
http://www.postgresql.org/docs/8.3/interactive/plpgsql-structure.html
regards
Pavel Stehule
> Thanks,
> Suresh
>
> --- On Sun, 7/20/08, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
> From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> Subject: Re: [GENERAL] Writing a user defined function
> To: "Suresh_" <suiyengar(at)yahoo(dot)com>
> Cc: pgsql-general(at)postgresql(dot)org
> Date: Sunday, July 20, 2008, 1:33 AM
>
> Hello
>
> what is version of your postgresql?
>
> regards
> Pavel Stehule
>
> 2008/7/20 Suresh_ <suiyengar(at)yahoo(dot)com>:
>>
>> I get this error
>>
>> ERROR: syntax error at or near "cursor"
>>
> CONTEXT: invalid type name "scroll cursor for select * from
> tpcd.customer"
>> compile of PL/pgSQL function "udf" near line 5
>>
>>
>> Douglas McNaught wrote:
>>>
>>> On Fri, Jul 18, 2008 at 12:07 PM, Suresh_ <suiyengar(at)yahoo(dot)com>
> wrote:
>>>>
>>>> Hello,
>>>> I am trying to code a simple udf in postgres. How do I write sql
>>>> commands
>>>> into pl/sql ? The foll. code doesnt work.
>>>>
>>>> CREATE OR REPLACE FUNCTION udf()
>>>> RETURNS integer AS $$
>>>> BEGIN
>>>> for i in 1..2000 loop
>>>> for j in 1...10000 loop
>>>> end loop;
>>>> begin work;
>>>
>>> Postgres doesn't let you do transactions inside a function.
>>>
>>> Take out the BEGIN and COMMIT, and if you still get errors post the
>>> function code and the error
> message that you get.
>>>
>>> -Doug
>>>
>>> --
>>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgsql-general
>>>
>>>
>>
>> --
>> View this message in context:
> http://www.nabble.com/Writing-a-user-defined-function-tp18532591p18551845.html
>> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Urban | 2008-07-20 18:08:21 | question about performance |
Previous Message | Suresh | 2008-07-20 14:59:08 | Re: Writing a user defined function |