DBLINK_SEND_QUERY(3)

πŸ“¦ version 15.19, in opensuse-leap 16.0

okay so this is a PostgreSQL 15.19 manual page, it's dblink_send_query(3), and honestly? she's kind of a vibe. sit down, grab a strawberry drink πŸ“, and let me tell you everything.


✨ NAME ✨

dblink_send_query β€” sends an async query to a remote database. that's it. that's the whole thing. fire. πŸ”₯


🌸 SYNOPSIS 🌸

dblink_send_query(text connname, text sql) returns int

look at her. two text args, returns an int. iconic signature, no notes. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so dblink_send_query sends a query to be executed asynchronously β€” meaning it fires the query off without immediately waiting for the result. it's giving "i sent the text, i'm not staring at the screen waiting for the typing bubble" energy. πŸ’…

but listen β€” there must not be an async query already in progress on the connection. like, one at a time, bestie. no cap.

after you've successfully dispatched an async query, you can check the completion status with dblink_is_busy, and the results are ultimately collected with dblink_get_result. πŸŽ€

it's also possible to attempt to cancel an active async query using dblink_cancel_query.

so the whole little friend group is dblink_send_query β†’ dblink_is_busy β†’ dblink_get_result, with dblink_cancel_query as the "jk nvm" option. iykyk. 🧚

πŸŽ€ ARGUMENTS πŸŽ€

  • connname β€” name of the connection to use. literally the name of the connection. that's the whole job and she does it flawlessly. 🫢
  • sql β€” the SQL statement that you wish to execute in the remote database, for example select * from pg_class. go off, query queen. ⭐

πŸ’– RETURN VALUE πŸ’–

returns 1 if the query was successfully dispatched, 0 otherwise. binary queen. no in-between. 🌈


πŸ”₯ EXAMPLES πŸ”₯

here's the moment you've been waiting for, the demo:

SELECT dblink_send_query('dtest1', 'SELECT * FROM foo WHERE f1 < 3');

ate. no crumbs. dtest1 is the connection, and that SELECT is off doing its thing asynchronously. πŸ’€βœ¨


and that's the page!! fr fr that's everything, nothing skipped, every last detail accounted for. πŸ“

sign-off era πŸŽ€: this was DBLINK_SEND_QUERY(3) from the PostgreSQL 15.19 Documentation, dated 2026 β€” and the footer still says DBLINK_SEND_QUERY(3) because she's consistent like that. mwah. πŸ’œπŸ¦‹

πŸ“¦ where this page comes from