WARNING

This text was automatically converted from troff me macros to HTML. Information may have been lost, added, or changed in the process. Lars Aronsson and Lysator do not guarantee the correctness of this HTML document.

NAME

fetch *- fetch instance(s) from a portal

SYNOPSIS

fetch [ (forward | backward) ] [ ( number | all) ] [in portal_name]

DESCRIPTION

Fetch allows a user to retrieve instances from a portal named portal_name . The number of instances retrieved is specified by number . If the number of instances remaining in the portal is less than number , then only those available are fetched. Substituting the keyword all in place of a number will cause all remaining instances in the portal to be retrieved. Instances may be fetched in both forward and backward directions. The default direction is forward .

Updating data in a portal is not supported by POSTGRES, because mapping portal updates back to base classes is impossible in general as with view updates. Consequently, users must issue explicit replace commands to update data.

Portals may only be used inside of begin/end transaction blocks, since the data that they store spans multiple user queries.

EXAMPLE

/* set up and use a portal */
   begin \g
   retrieve portal myportal (pg_user.all) \g
   fetch 2 in myportal \g
   fetch all in myportal \g
   close myportal \g
   end \g

/* Fetch all the instances available in the portal FOO */
   fetch all in FOO
 
/* Fetch 5 instances backward in the portal FOO */
   fetch backward 5 in FOO

SEE ALSO

retrieve(commands), close(commands), move(commands).

BUGS

Currently, the smallest transaction in POSTGRES is a single POSTQUEL command. It should be possible for a single fetch to be a transaction.