QuackScale SQL reference

June 2, 2026 · View on GitHub

Every function the quackscale extension registers. For how to combine them, see GUIDE.md.

Loading

LOAD quackscale;   -- this extension
LOAD quack;        -- required for quack_serve, ATTACH 'quack:…', and quack_query

quack_serve, quack_stop, quack_query, and ATTACH 'quack:…' belong to the upstream quack extension, not to quackscale. They are documented there. quackscale registers the functions below.

Table functions are invoked with CALL. Scalar functions (quack_uri, quack_token) are invoked in a SELECT. Credentials and environment variables are documented in AUTHENTICATION.md; they are not repeated here.

Two ports recur as defaults: 9494 is the Quack remote protocol port; 19494 is the default loopback port for tailscale_quack_forward.


Tailnet lifecycle

tailscale_up

CALL tailscale_up(hostname => 'analytics-hub', state_dir => '/var/lib/quacktail/hub');

Joins the tailnet and blocks until the node is up. On success, installs the transparent HTTP router unless http_route => false. Intended for servers, CI, and automation.

The first positional argument, if given, sets hostname.

ParameterTypeDefaultMeaning
hostnameVARCHARnoneNode name on the tailnet. May also be passed positionally.
authkeyVARCHARTS_AUTHKEY envTailscale or Headscale preauth key.
control_urlVARCHARTailscale SaaSControl-plane URL. Set for Headscale.
state_dirVARCHARnoneDirectory for persisted tailnet identity.
ephemeralBOOLEANfalseRegister as an ephemeral node, removed when it disconnects.
loopback_proxyBOOLEANfalseStart the libtailscale loopback SOCKS proxy (used by the deprecated tailscale_quack_proxy).
http_routeBOOLEANtrueInstall the transparent tailnet HTTP router (see Transparent HTTP routing).

Returns one row:

ColumnTypeMeaning
runningBOOLEANNode is up.
hostnameVARCHARNode name, or NULL.
tailnet_ipsVARCHAR[]Assigned tailnet addresses.

tailscale_login

CALL tailscale_login(hostname => 'my-laptop', state_dir => '~/.local/share/duckdb/quackscale');

Begins a non-blocking, browser-based join and returns immediately. The returned login_url is opened in a browser to complete authentication; progress is polled with tailscale_login_status. The transparent HTTP router is installed immediately unless http_route => false, and stays inert until the node comes up. Intended for first-time interactive setup.

Accepts the same parameters as tailscale_up.

Returns one row:

ColumnTypeMeaning
statusVARCHARstarting, needs_login, up, error, or idle.
login_urlVARCHARBrowser authentication URL, or NULL.
messageVARCHARHuman-readable status detail.

tailscale_login_status

CALL tailscale_login_status();

Reports the state of an interactive login started by tailscale_login. Takes no parameters. Returns one row:

ColumnTypeMeaning
statusVARCHARstarting, needs_login, up, error, or idle.
login_urlVARCHARBrowser authentication URL, or NULL.
messageVARCHARStatus detail, or NULL.
runningBOOLEANNode is up.
hostnameVARCHARNode name, or NULL.
tailnet_ipsVARCHAR[]Assigned tailnet addresses.

tailscale_status

CALL tailscale_status();

Reports tailnet connectivity. Takes no parameters. Returns one row:

ColumnTypeMeaning
libtailscale_linkedBOOLEANThe build links libtailscale.
runningBOOLEANNode is up.
hostnameVARCHARNode name, or NULL.
tailnet_ipsVARCHAR[]Assigned tailnet addresses.

tailscale_down

CALL tailscale_down();

Stops the forwarder and closes tsnet. Takes no parameters. One-shot processes hang after their SQL finishes unless this is called, because tailscale_up and the forwarder run background threads. Returns one row:

ColumnTypeMeaning
shutdown_okBOOLEANAlways true.

Connectivity on the mesh

tailscale_serve_local

CALL tailscale_serve_local(port => 9494);

Configures Tailscale Serve to forward tailnet TCP on port to 127.0.0.1:local_port. Run on a server after quack_serve so peers can reach the local Quack listener.

ParameterTypeDefaultMeaning
portBIGINT9494Tailnet-facing port. Must be 1–65535.
local_portBIGINTvalue of portLoopback port to forward to. Must be 1–65535.

Returns one row:

ColumnTypeMeaning
listen_portINTEGERTailnet-facing port.
local_portINTEGERLoopback target port.
local_forwardVARCHAR127.0.0.1:<local_port>.

tailscale_ping

CALL tailscale_ping(host => 'peer', port => 9494);

Dials host:port over tsnet to confirm a peer is reachable before an ATTACH or query. Requires the node to be up. Errors if the dial fails.

ParameterTypeDefaultMeaning
hostVARCHARrequiredTailnet host to dial.
portBIGINT9494Port to dial. Must be 1–65535.
timeout_msBIGINT5000Dial timeout in milliseconds. Must be positive.

Returns one row:

ColumnTypeMeaning
hostVARCHARHost dialed.
portINTEGERPort dialed.
reachableBOOLEANtrue on a successful dial.

tailscale_quack_forward

CALL tailscale_quack_forward(host => 'peer', port => 9494, local_port => 19494);

Opens a loopback listener that dials host:port over tsnet for each incoming Quack connection, and returns a quack:127.0.0.1:<local_port> URI. Used for MagicDNS short names (which the transparent router does not match), a pinned local port, or non-HTTP clients; otherwise ATTACH 'quack:100.x:9494' works directly after tailscale_up. Requires the node to be up.

ParameterTypeDefaultMeaning
hostVARCHARrequiredTailnet peer to dial.
portBIGINT9494Remote port. Must be 1–65535.
local_portBIGINT19494Loopback listen port. Must be 0–65535; 0 lets the OS choose.

Returns one row:

ColumnTypeMeaning
activeBOOLEANListener is running.
remote_hostVARCHARPeer host, or NULL.
remote_portINTEGERPeer port.
local_portINTEGERLoopback listen port.
quack_uriVARCHARquack:127.0.0.1:<local_port>, or NULL.

Transparent HTTP routing

When tailscale_up or tailscale_login runs with http_route => true (the default), QuackScale installs a global HTTP util that intercepts http:// requests to tailnet hosts and dials them over tsnet. A tailnet host is an IPv4 address in 100.64.0.0/10 or a *.ts.net MagicDNS name. Bare MagicDNS short names are not matched and still require tailscale_quack_forward. All other HTTP traffic, and all https://, passes to the underlying util unchanged. With routing on, ATTACH 'quack:100.x:9494' and ATTACH 'quack:host.ts.net:9494' work without a forwarder.


Quack helpers

These describe how the local node appears as a Quack endpoint on the tailnet. quack_serve and ATTACH themselves come from the quack extension and require LOAD quack.

quack_uri

SELECT quack_uri();

Scalar function. Returns this node's client-facing quack:<host>:9494 URI, preferring MagicDNS and falling back to the tailnet IP. Takes no arguments. Errors if the node is not up.

quack_token

SELECT quack_token();

Scalar function. Returns the shared Quack token read from the QUACK_TAILNET_TOKEN environment variable, or QUACK_TOKEN if the first is unset. Takes no arguments. Errors if neither is set or the token is shorter than four characters. See AUTHENTICATION.md.

quack_discover

CALL quack_discover(port => 9494);

Lists every quack: URI this node advertises on the tailnet, one row per MagicDNS name and per tailnet IP.

ParameterTypeDefaultMeaning
portBIGINT9494Advertised port. Must be 1–65535.

Returns one row per endpoint:

ColumnTypeMeaning
listen_uriVARCHARFull quack:<host>:<port> URI.
hostVARCHARMagicDNS name or tailnet IP.
portINTEGERAdvertised port.
viaVARCHARmagicdns or tailnet_ip.

Remote DuckLake

attach_ducklake

CALL attach_ducklake(
    'quack:127.0.0.1:19494',
    remote_catalog => 'lake',
    alias => 'lake',
    token => '…',
    disable_ssl => true
);

Creates a local schema of views over the tables of a DuckLake catalog attached on a remote Quack server, when the Parquet files live only on that server. Each view delegates to the server through quack_query. Requires LOAD quack. The views are read-only, do not push down predicates, and must be re-created after the server schema changes. The first positional argument is the Quack URI of the server.

ParameterTypeDefaultMeaning
(positional)VARCHARrequiredQuack URI of the remote server.
remote_catalogVARCHAR'lake'Database name of the DuckLake catalog on the server.
aliasVARCHARvalue of remote_catalogLocal schema name for the created views.
tokenVARCHARnoneQuack token forwarded to the server.
disable_sslBOOLEANtrueConnect over plaintext HTTP (the tailnet is the encryption layer).

remote_catalog and alias must be valid SQL identifiers ([A-Za-z_][A-Za-z0-9_]*). Errors if the remote catalog holds no tables.

Returns one row per created view:

ColumnTypeMeaning
local_viewVARCHAR<alias>.<table>.
remote_tableVARCHAR<remote_catalog>.<table>.
statusVARCHARAlways created.

(Deprecated) legacy SOCKS proxy

These predate transparent HTTP routing and tailscale_quack_forward. New deployments use the forwarder.

tailscale_quack_proxy

CALL tailscale_quack_proxy();

Deprecated. Enables a libtailscale loopback SOCKS proxy and exports ALL_PROXY so Quack HTTP routes through tsnet. Takes no parameters. Requires the node to be up. Use tailscale_quack_forward instead. Returns one row:

ColumnTypeMeaning
activeBOOLEANProxy is running.
listen_addrVARCHARLoopback listen address, or NULL.
proxy_urlVARCHARSOCKS URL with the password redacted, or NULL.

tailscale_proxy_status

CALL tailscale_proxy_status();

Deprecated. Reports the state of the legacy SOCKS proxy. Takes no parameters. Returns one row:

ColumnTypeMeaning
enabledBOOLEANProxy was requested.
activeBOOLEANProxy is running.
listen_addrVARCHARLoopback listen address, or NULL.
proxy_urlVARCHARSOCKS URL with the password redacted, or NULL.

See also

ResourceTopic
GUIDE.mdHow to combine these functions into working deployments.
AUTHENTICATION.mdTailnet and Quack credentials, environment variables.
Why QuackScaleRationale and design.
Quack overviewThe upstream quack extension: quack_serve, ATTACH 'quack:…', quack_query.
DuckLake docsCatalog, Parquet, and attach.