Thread: proposal - new SPI cursor function

proposal - new SPI cursor function

From
"Pavel Stehule"
Date:
Hello,

I am working on support scrollable cursors in plpgpsm. Scrollable cursors 
are in ToDo for plpgsql too. I need new function  
SPI_cursor_fetch_with_direction(Portal portal, int direction, long count) 
where is possible set direction of fetch statement.

any comments?

Regards

Pavel Stehule

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci. 
http://messenger.msn.cz/



Re: proposal - new SPI cursor function

From
"Simon Riggs"
Date:
On Wed, 2007-01-03 at 18:30 +0100, Pavel Stehule wrote:

> I am working on support scrollable cursors in plpgpsm. Scrollable cursors 
> are in ToDo for plpgsql too. I need new function  
> SPI_cursor_fetch_with_direction(Portal portal, int direction, long count) 
> where is possible set direction of fetch statement.

Sounds good.

Please ensure the default for PL/pgSQL remains as non-scrollable. That
may or may not be the same for plpgpsm.

--  Simon Riggs              EnterpriseDB   http://www.enterprisedb.com




Re: proposal - new SPI cursor function

From
"Pavel Stehule"
Date:
>
> > I am working on support scrollable cursors in plpgpsm. Scrollable 
>cursors
> > are in ToDo for plpgsql too. I need new function
> > SPI_cursor_fetch_with_direction(Portal portal, int direction, long 
>count)
> > where is possible set direction of fetch statement.
>
>Sounds good.
>
>Please ensure the default for PL/pgSQL remains as non-scrollable. That
>may or may not be the same for plpgpsm.
>

Default plpgpsm cursors are non scrollable too. But I have to do two 
patches. Syntax of declare section is total different. Between SQL/PSM and 
plpgsql is only one big difference (in default values). SQL/PSM procedures 
are flagged SECURITY DEFINER and plpgsql run wit default SECURITY CALLER.

Pavel

_________________________________________________________________
Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/



Re: proposal - new SPI cursor function

From
David Fetter
Date:
On Wed, Jan 03, 2007 at 06:30:48PM +0100, Pavel Stehule wrote:
> Hello,
> 
> I am working on support scrollable cursors in plpgpsm. Scrollable cursors 
> are in ToDo for plpgsql too. I need new function  
> SPI_cursor_fetch_with_direction(Portal portal, int direction, long count) 

Is "int" a reasonable domain for directions?  I'd think there would be
at most values.

Cheers,
D
> where is possible set direction of fetch statement.

> 
> any comments?
> 
> Regards
> 
> Pavel Stehule
> 
> _________________________________________________________________
> Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci. 
> http://messenger.msn.cz/
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly

-- 
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!


Re: proposal - new SPI cursor function

From
David Fetter
Date:
On Wed, Jan 03, 2007 at 12:36:27PM -0800, David Fetter wrote:
> On Wed, Jan 03, 2007 at 06:30:48PM +0100, Pavel Stehule wrote:
> > Hello,
> > 
> > I am working on support scrollable cursors in plpgpsm. Scrollable cursors 
> > are in ToDo for plpgsql too. I need new function  
> > SPI_cursor_fetch_with_direction(Portal portal, int direction, long count) 
> 
> Is "int" a reasonable domain for directions?  I'd think there would be
> at most values.

Er, "at most two."

Cheers,
D
> 
> Cheers,
> D
> > where is possible set direction of fetch statement.
> 
> > 
> > any comments?
> > 
> > Regards
> > 
> > Pavel Stehule
> > 
> > _________________________________________________________________
> > Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci. 
> > http://messenger.msn.cz/
> > 
> > 
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: if posting/reading through Usenet, please send an appropriate
> >       subscribe-nomail command to majordomo@postgresql.org so that your
> >       message can get through to the mailing list cleanly
> 
> -- 
> David Fetter <david@fetter.org> http://fetter.org/
> phone: +1 415 235 3778        AIM: dfetter666
>                               Skype: davidfetter
> 
> Remember to vote!
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match

-- 
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!


Re: proposal - new SPI cursor function

From
"Pavel Stehule"
Date:
i> >
> > Is "int" a reasonable domain for directions?  I'd think there would be
> > at most values.
>
>Er, "at most two."
>

enum is better, true

tree fields: FORWARD, BACKWARD, ABSOLUTE



>Cheers,
>D
> >
> > Cheers,
> > D
> > > where is possible set direction of fetch statement.
> >
> > >
> > > any comments?
> > >
> > > Regards
> > >
> > > Pavel Stehule
> > >
> > > _________________________________________________________________
> > > Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
> > > http://messenger.msn.cz/
> > >
> > >
> > > ---------------------------(end of 
>broadcast)---------------------------
> > > TIP 1: if posting/reading through Usenet, please send an appropriate
> > >       subscribe-nomail command to majordomo@postgresql.org so that 
>your
> > >       message can get through to the mailing list cleanly
> >
> > --
> > David Fetter <david@fetter.org> http://fetter.org/
> > phone: +1 415 235 3778        AIM: dfetter666
> >                               Skype: davidfetter
> >
> > Remember to vote!
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 9: In versions below 8.0, the planner will ignore your desire to
> >        choose an index scan if your joining column's datatypes do not
> >        match
>
>--
>David Fetter <david@fetter.org> http://fetter.org/
>phone: +1 415 235 3778        AIM: dfetter666
>                               Skype: davidfetter
>
>Remember to vote!

_________________________________________________________________
Citite se osamele? Poznejte nekoho vyjmecneho diky Match.com. 
http://www.msn.cz/



Re: proposal - new SPI cursor function

From
Tom Lane
Date:
"Pavel Stehule" <pavel.stehule@hotmail.com> writes:
> I need new function  
> SPI_cursor_fetch_with_direction(Portal portal, int direction, long count) 
> where is possible set direction of fetch statement.

Huh?  SPI_cursor_fetch already lets you specify forward or backward.
        regards, tom lane


Re: proposal - new SPI cursor function

From
"Pavel Stehule"
Date:
>
>"Pavel Stehule" <pavel.stehule@hotmail.com> writes:
> > I need new function
> > SPI_cursor_fetch_with_direction(Portal portal, int direction, long 
>count)
> > where is possible set direction of fetch statement.
>
>Huh?  SPI_cursor_fetch already lets you specify forward or backward.
>
>            regards, tom lane

It doesn't allow FETCH_ABSOLUTE

Regards
Pavel Stehule

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci. 
http://messenger.msn.cz/



Re: proposal - new SPI cursor function

From
"Zeugswetter Andreas ADI SD"
Date:
> > > I am working on support scrollable cursors in plpgpsm. Scrollable
cursors
> > > are in ToDo for plpgsql too. I need new function
> > > SPI_cursor_fetch_with_direction(Portal portal, int direction, long
count)
> >
> > Is "int" a reasonable domain for directions?  I'd think there would
be
> > at most values.
>
> enum is better, true

I don't think we want an enum here (maybe short).

> tree fields: FORWARD, BACKWARD, ABSOLUTE

I think for fetch absolute you are missing an offset argument.

Andreas