2 .\" Title: dblink_get_pkey
3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "DBLINK_GET_PKEY" "3" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 dblink_get_pkey \- returns the positions and field names of a relation\*(Aqs primary key fields
35 dblink_get_pkey(text relname) returns setof dblink_pkey_results
40 provides information about the primary key of a relation in the local database\&. This is sometimes useful in generating queries to be sent to remote databases\&.
45 Name of a local relation, for example
48 myschema\&.mytab\&. Include double quotes if the name is mixed\-case or contains special characters, for example
49 "FooBar"; without quotes, the string will be folded to lower case\&.
53 Returns one row for each primary key field, or no rows if the relation has no primary key\&. The result row type is defined as
59 CREATE TYPE dblink_pkey_results AS (position int, colname text);
67 column simply runs from 1 to
68 \fIN\fR; it is the number of the field within the primary key, not the number within the table\*(Aqs columns\&.
79 PRIMARY KEY (f1, f2, f3)
83 SELECT * FROM dblink_get_pkey(\*(Aqfoobar\*(Aq);
85 \-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-