Services
  • 24×7×365 Technical Support
  • Migration to PostgreSQL
  • High Availability Deployment
  • Database Audit
  • Remote DBA for PostgreSQL
Products
  • Postgres Pro Enterprise
  • Postgres Pro Standard
  • Cloud Solutions
  • Postgres Extensions
Resources
  • Blog
  • Documentation
  • Webinars
  • Videos
  • Presentations
Community
  • Events
  • Training Courses
  • Books
  • Demo Database
  • Mailing List Archives
About
  • Leadership team
  • Partners
  • Customers
  • In the News
  • Press Releases
  • Press Info

Facebook
Postgres Pro
  • Services
    24×7×365 Technical Support Migration to PostgreSQL High Availability Deployment Database Audit Remote DBA for PostgreSQL
  • Products
    Postgres Pro Enterprise Postgres Pro Standard Cloud Solutions Postgres Extensions
  • Resources
    Blog Documentation Webinars Videos Presentations
  • Community
    Events Training Courses Books Demo Database Mailing List Archives
  • About
    Leadership team Partners Customers In the News Press Releases Press Info
Facebook
Downloads
dblink_build_sql_delete
Prev UpF.13. dblinkHome Next

dblink_build_sql_delete

dblink_build_sql_delete — builds a DELETE statement using supplied values for primary key field values

Synopsis

dblink_build_sql_delete(text relname,
                        int2vector primary_key_attnums,
                        integer num_primary_key_atts,
                        text[] tgt_pk_att_vals_array) returns text

Description

dblink_build_sql_delete can be useful in doing selective replication of a local table to a remote database. It builds a SQL DELETE command that will delete the row with the given primary key values.

Arguments

relname

Name of a local relation, for example foo or myschema.mytab. Include double quotes if the name is mixed-case or contains special characters, for example "FooBar"; without quotes, the string will be folded to lower case.

primary_key_attnums

Attribute numbers (1-based) of the primary key fields, for example 1 2.

num_primary_key_atts

The number of primary key fields.

tgt_pk_att_vals_array

Values of the primary key fields to be used in the resulting DELETE command. Each field is represented in text form.

Return Value

Returns the requested SQL statement as text.

Notes

As of PostgreSQL 9.0, the attribute numbers in primary_key_attnums are interpreted as logical column numbers, corresponding to the column's position in 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.

Examples

SELECT dblink_build_sql_delete('"MyFoo"', '1 2', 2, '{"1", "b"}');
           dblink_build_sql_delete
---------------------------------------------
 DELETE FROM "MyFoo" WHERE f1='1' AND f2='b'
(1 row)

Prev Up Next
dblink_build_sql_insert Home dblink_build_sql_update
epub pdf

This page in other versions:

Postgres Pro Standard 17
Postgres Pro Standard 16
Postgres Pro Standard 15
Postgres Pro Standard 14
Postgres Pro Standard 13
Postgres Pro Standard 12
Postgres Pro Standard 11
Postgres Pro Standard 10
Postgres Pro Standard 9.6
Postgres Pro Standard 9.5
Postgres Pro Enterprise 17
Postgres Pro Enterprise 16
Postgres Pro Enterprise 15
Postgres Pro Enterprise 14
Postgres Pro Enterprise 13
Postgres Pro Enterprise 12
Postgres Pro Enterprise 11
Postgres Pro Enterprise 10
Postgres Pro Enterprise 9.6
PostgreSQL 17
PostgreSQL 16
PostgreSQL 15
PostgreSQL 14
PostgreSQL 13
PostgreSQL 12
PostgreSQL 11
PostgreSQL 10
PostgreSQL 9.6
PostgreSQL 9.5
PostgreSQL 9.4
Есть вопросы? Напишите нам!

Соглашаюсь с условиями обработки персональных данных



✖
×
Postgres Pro Standard 17 Postgres Pro Standard 16 Postgres Pro Standard 15 Postgres Pro Standard 14 Postgres Pro Standard 13 Postgres Pro Standard 12 Postgres Pro Standard 11 Postgres Pro Standard 10 Postgres Pro Standard 9.6 Postgres Pro Standard 9.5
Postgres Pro Enterprise 17 Postgres Pro Enterprise 16 Postgres Pro Enterprise 15 Postgres Pro Enterprise 14 Postgres Pro Enterprise 13 Postgres Pro Enterprise 12 Postgres Pro Enterprise 11 Postgres Pro Enterprise 10 Postgres Pro Enterprise 9.6
PostgreSQL 17 PostgreSQL 16 PostgreSQL 15 PostgreSQL 14 PostgreSQL 13 PostgreSQL 12 PostgreSQL 11 PostgreSQL 10 PostgreSQL 9.6 PostgreSQL 9.5 PostgreSQL 9.4
Go to Postgres Pro Enterprise 10
Services
  • 24×7×365 Technical Support
  • Migration to PostgreSQL
  • High Availability Deployment
  • Database Audit
  • Remote DBA for PostgreSQL
Products
  • Postgres Pro Enterprise
  • Postgres Pro Standard
  • Cloud Solutions
  • Postgres Extensions
Resources
  • Blog
  • Documentation
  • Webinars
  • Videos
  • Presentations
Community
  • Events
  • Training Courses
  • Books
  • Demo Database
  • Mailing List Archives
About
  • Leadership team
  • Partners
  • Customers
  • In the News
  • Press Releases
  • Press Info
Products
  • Postgres Pro Enterprise
  • Postgres Pro Standard
  • Cloud Solutions
  • Postgres Extensions
Resources
  • Blog
  • Documentation
  • Webinars
  • Videos
  • Presentations
Services
  • 24×7×365 Technical Support
  • Migration to Postgres
  • High Availability Deployment
  • Database Audit
  • Remote DBA for PostgreSQL
Community
  • Events
  • Training Courses
  • Intro Book
  • Demo Database
  • Mailing List Archives
About
  • Leadership team
  • Partners
  • Customers
  • In the News
  • Press Releases
  • Press Info
Contacts
  • Neptune House, Marina Bay, office 207, Gibraltar, GX11 1AA
  • info@postgrespro.com
  • Facebook
Get in touch!



© Postgres Professional Europe Limited, 2015 — 2025
EULA EULA for Cloud Environments Privacy Policy GDPR Compliance Commitment
© Postgres Professional Europe Limited, 2015 — 2025
EULA
EULA for Cloud Environments
Privacy Policy
GDPR Compliance Commitment
By continuing to browse this website, you agree to the use of cookies. Go to Privacy Policy.