DBLINK_SEND_QUERY(3)
β¨ dblink_send_query β¨
okay bestie, so this is the page for dblink_send_query(3) from the PostgreSQL 18.6 docs, and honestly? it's giving fire-and-forget but make it SQL. π
πΈ NAME πΈ
dblink_send_query β sends an async query to a remote database π¦
π SYNOPSIS π
dblink_send_query(text connname, text sql) returns int
π DESCRIPTION π
So here's the vibe: dblink_send_query fires off a query to be executed asynchronously, meaning it does not sit there waiting for the result like some clingy function. It just sends it and dips. βοΈ
π¨ IMPORTANT GIRL MATH: there must not be an async query already in progress on that connection. One at a time, bestie. Don't be messy. π
Once you've successfully dispatched an async query, you can check on its completion status with dblink_is_busy, and then eventually collect the results with dblink_get_result. Also, if you're feeling spicy, you can attempt to cancel an active async query using dblink_cancel_query. π₯
β¨ ARGUMENTS β¨
connnameβ the name of the connection you wanna use. your lil connection nickname, basically. π«sqlβ the SQL statement you wish to execute in the remote database, for exampleselect * from pg_class. yes, you literally type the SQL. iconic. π
π RETURN VALUE π
Returns 1 if the query was successfully dispatched, 0 otherwise. slay or don't slay, there is no in between. π«Ά
π§ EXAMPLES π§
SELECT dblink_send_query('dtest1', 'SELECT * FROM foo WHERE f1 < 3');
look at her go. query dispatched, no waiting, main character energy. β
and that's the whole page, babe. this came out of the PostgreSQL 18.6 docs, dated 2026, so when you're out here async-querying remote databases, remember who told you how. mwah. π π π
π¦ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 Β· PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 Β· PostgreSQL
- arch rolling: postgresql 18.6-4 Β· PostgreSQL
- fedora 43: postgresql-contrib 18.6-1.fc43 Β· PostgreSQL
- fedora 44: postgresql-contrib 18.6-1.fc44 Β· PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-doc-18 18.6-0ubuntu0.26.04.1 Β· PostgreSQL
- ubuntu stonking: postgresql-doc-18 18.6-3build2 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms