2 .\" Title: dblink_build_sql_delete
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_BUILD_SQL_DELETE" "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_build_sql_delete \- builds a DELETE statement using supplied values for primary key field values
35 dblink_build_sql_delete(text relname,
36 int2vector primary_key_attnums,
37 integer num_primary_key_atts,
38 text[] tgt_pk_att_vals_array) returns text
42 \fBdblink_build_sql_delete\fR
43 can be useful in doing selective replication of a local table to a remote database\&. It builds an SQL
45 command that will delete the row with the given primary key values\&.
50 Name of a local relation, for example
53 myschema\&.mytab\&. Include double quotes if the name is mixed\-case or contains special characters, for example
54 "FooBar"; without quotes, the string will be folded to lower case\&.
57 \fIprimary_key_attnums\fR
59 Attribute numbers (1\-based) of the primary key fields, for example
63 \fInum_primary_key_atts\fR
65 The number of primary key fields\&.
68 \fItgt_pk_att_vals_array\fR
70 Values of the primary key fields to be used in the resulting
72 command\&. Each field is represented in text form\&.
76 Returns the requested SQL statement as text\&.
81 9\&.0, the attribute numbers in
82 \fIprimary_key_attnums\fR
83 are interpreted as logical column numbers, corresponding to the column\*(Aqs position in
84 SELECT * FROM relname\&. Previous versions interpreted the numbers as physical column positions\&. There is a difference if any column(s) to the left of the indicated column have been dropped during the lifetime of the table\&.
91 SELECT dblink_build_sql_delete(\*(Aq"MyFoo"\*(Aq, \*(Aq1 2\*(Aq, 2, \*(Aq{"1", "b"}\*(Aq);
92 dblink_build_sql_delete
93 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
94 DELETE FROM "MyFoo" WHERE f1=\*(Aq1\*(Aq AND f2=\*(Aqb\*(Aq