2
.\" Title: dblink_fetch
3
.\" Author: The PostgreSQL Global Development Group
4
.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
6
.\" Manual: PostgreSQL 9.1beta1 Documentation
7
.\" Source: PostgreSQL 9.1beta1
10
.TH "DBLINK_FETCH" "3" "2011-04-27" "PostgreSQL 9.1beta1" "PostgreSQL 9.1beta1 Documentation"
11
.\" -----------------------------------------------------------------
12
.\" * set default formatting
13
.\" -----------------------------------------------------------------
14
.\" disable hyphenation
16
.\" disable justification (adjust text to left margin only)
18
.\" -----------------------------------------------------------------
19
.\" * MAIN CONTENT STARTS HERE *
20
.\" -----------------------------------------------------------------
22
dblink_fetch \- returns rows from an open cursor in a remote database
26
dblink_fetch(text cursorname, int howmany [, bool fail_on_error]) returns setof record
27
dblink_fetch(text connname, text cursorname, int howmany [, bool fail_on_error]) returns setof record
32
fetches rows from a cursor previously established by
38
Name of the connection to use; omit this parameter to use the unnamed connection\&.
43
The name of the cursor to fetch from\&.
48
The maximum number of rows to retrieve\&. The next
50
rows are fetched, starting at the current cursor position, moving forward\&. Once the cursor has reached its end, no more rows are produced\&.
55
If true (the default when omitted) then an error thrown on the remote side of the connection causes an error to also be thrown locally\&. If false, the remote error is locally reported as a NOTICE, and the function returns no rows\&.
59
The function returns the row(s) fetched from the cursor\&. To use this function, you will need to specify the expected set of columns, as previously discussed for
63
On a mismatch between the number of return columns specified in the
65
clause, and the actual number of columns returned by the remote cursor, an error will be thrown\&. In this event, the remote cursor is still advanced by as many rows as it would have been if the error had not occurred\&. The same is true for any other error occurring in the local query after the remote
74
SELECT dblink_connect(\(aqdbname=postgres\(aq);
76
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
80
SELECT dblink_open(\(aqfoo\(aq, \(aqselect proname, prosrc from pg_proc where proname like \(aq\(aqbytea%\(aq\(aq\(aq);
82
\-\-\-\-\-\-\-\-\-\-\-\-\-
86
SELECT * FROM dblink_fetch(\(aqfoo\(aq, 5) AS (funcname name, source text);
88
\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-
96
SELECT * FROM dblink_fetch(\(aqfoo\(aq, 5) AS (funcname name, source text);
98
\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-
101
bytealike | bytealike
106
SELECT * FROM dblink_fetch(\(aqfoo\(aq, 5) AS (funcname name, source text);
108
\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-
109
byteanlike | byteanlike
113
SELECT * FROM dblink_fetch(\(aqfoo\(aq, 5) AS (funcname name, source text);
115
\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-