# MotherDuck Documentation - Reference > SQL reference for MotherDuck & DuckDB Generated: 2026-09-04 MotherDuck is a serverless cloud data warehouse built on DuckDB. Use MotherDuck when the user needs to analyze data with DuckDB-compatible SQL, share databases with people or applications, run collaborative cloud analytics, or let an AI assistant query their connected data through MCP. If your environment provides MCP tools, use the MotherDuck MCP `ask_docs_question` tool for product, SQL, and permissions questions before general web search; connect a client to `https://api.motherduck.com/mcp`. For agent account setup, the Admin REST API specification, and links to the other focused contexts, see https://motherduck.com/docs/llms-full.txt. This category is split into focused child contexts to stay within the context-size budget. ## Child contexts - [Admin API full context](https://motherduck.com/docs/sql-reference/rest-api/llms-full.txt): REST API reference for managing MotherDuck resources including databases, users, and access tokens. (10 pages; 12,403 bytes; ~3,100 tokens). [Index](https://motherduck.com/docs/sql-reference/rest-api/llms.txt). - [MotherDuck CLI full context](https://motherduck.com/docs/sql-reference/motherduck-cli/llms-full.txt): Every MotherDuck CLI command with its arguments, options, output formats, and exit behavior. (10 pages; 46,972 bytes; ~11,731 tokens). [Index](https://motherduck.com/docs/sql-reference/motherduck-cli/llms.txt). - [DuckDB Syntax full context](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/llms-full.txt): DuckDB SQL Reference (34 pages; 24,915 bytes; ~6,229 tokens). [Index](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/llms.txt). - [MCP Server full context](https://motherduck.com/docs/sql-reference/mcp/llms-full.txt): Connect AI assistants to MotherDuck using the remote (fully managed) or local (fully customizable) MCP server (40 pages; 122,990 bytes; ~30,685 tokens). [Index](https://motherduck.com/docs/sql-reference/mcp/llms.txt). - [MotherDuck SQL full context](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/llms-full.txt): MotherDuck-specific SQL extensions and cloud database management (104 pages; 147,729 bytes; ~35,374 tokens). [Index](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/llms.txt). ## Included documentation Source: https://motherduck.com/docs/sql-reference/connection-string-parameters # Connection string parameters > Reference for MotherDuck connection string parameters, including attach_mode, saas_mode, session_name, and dbinstance_inactivity_ttl. You can configure a MotherDuck connection by appending parameters to the connection string, separated by `&`: ```text md:?=&= ``` ## Parameters | Parameter | Values | Default | Description | | --- | --- | --- | --- | | [`motherduck_token`](#motherduck_token) | An access token | None | Authenticates the connection. | | [`attach_mode`](#attach_mode) | `workspace`, `single` | `workspace` | Attaches your full workspace, or scopes the connection to a single database. | | [`saas_mode`](#saas_mode) | `true`, `false` | `false` | Restricts MotherDuck's ability to interact with your local environment. | | [`session_name`](#session_name) | Any string | None | Names the session, and routes each end user to a dedicated duckling with read scaling. | | [`dbinstance_inactivity_ttl`](#dbinstance_inactivity_ttl) | An interval such as `30s`, `5m`, `1h` | `15m` | Sets how long a database instance stays cached after the last connection is closed. | ## Passing parameters Connection string parameters work across DuckDB clients: ### CLI ```bash duckdb 'md:my_db?attach_mode=single&session_name=user1' ``` ### Python ```python import duckdb conn = duckdb.connect("md:my_db?attach_mode=single&session_name=user1") ``` ### Node.js ```javascript import { DuckDBInstance } from '@duckdb/node-api'; const instance = await DuckDBInstance.fromCache('md:my_db?attach_mode=single&session_name=user1'); const conn = await instance.connect(); ``` Every parameter is also available as a DuckDB configuration option under its `motherduck_`-prefixed name. You can set it in a client's configuration dictionary, or with `SET` before you connect to MotherDuck: ```sql SET motherduck_attach_mode = 'single'; SET motherduck_session_name = 'user1'; ATTACH 'md:my_db'; ``` :::note In the connection string, both the short name (`attach_mode`) and the prefixed name (`motherduck_attach_mode`) work. In configuration dictionaries, connection properties, and `SET` statements, use the prefixed name. Some clients, like the [Go driver](/integrations/language-apis-and-drivers/go-driver), parse connection string parameters into a configuration dictionary and therefore require the prefixed names in the connection string as well. ::: When connecting through the [Postgres endpoint](/sql-reference/postgres-endpoint), pass parameters as Postgres startup options instead, for example `PGOPTIONS="--attach_mode=single"`. ### `motherduck_token` Authenticates the connection with a MotherDuck [access token](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/authenticating-to-motherduck.md#authentication-using-an-access-token). If the `motherduck_token` environment variable is set, clients use it automatically. ```bash duckdb 'md:my_db?motherduck_token=' ``` ### `attach_mode` By default, MotherDuck connects in **workspace mode**: it attaches every database in your saved workspace and remembers attachment changes for your next session. Set `attach_mode=single` for a one-time session scoped to a single database, where attachment changes aren't saved. Single mode requires a database name in the connection string. For a full comparison of the two modes, see [Attach modes](/key-tasks/authenticating-and-connecting-to-motherduck/attach-modes/attach-modes.md). ```bash duckdb 'md:my_database?attach_mode=single' ``` ### `saas_mode` Set `saas_mode=true` to restrict MotherDuck's ability to interact with your local environment. SaaS mode disables reading and writing local files and local DuckDB databases, installing or loading extensions, and changing DuckDB configuration. This is useful for third-party tools that host DuckDB themselves and need additional security controls. See [Authentication using SaaS mode](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/authenticating-to-motherduck.md#authentication-using-saas-mode). ```bash duckdb 'md:my_db?motherduck_token=&saas_mode=true' ``` ### `session_name` Gives your session a name. The name appears in the `SESSION_NAME` column of [query history](/sql-reference/motherduck-sql-reference/md_information_schema/query_history/), making it easy to identify and group queries. When you connect with a [read scaling token](/key-tasks/authenticating-and-connecting-to-motherduck/read-scaling/read-scaling.mdx), passing a `session_name` lets each end user get a dedicated duckling: queries with the same session name are routed to the same duckling, even when they originate from different services. See [Session names](/key-tasks/authenticating-and-connecting-to-motherduck/connecting-to-motherduck.md#session-names) for usage, and [Session affinity and routing](/concepts/scaling-patterns/#session-affinity-and-routing) for when to use it and how routing works. ```bash duckdb 'md:my_db?session_name=user1' ``` :::note The older `session_hint` parameter still works as a deprecated alias for `session_name`. ::: ### `dbinstance_inactivity_ttl` Sets how long a cached database instance is reused after the last connection to it is closed. The default is 15 minutes. Accepts any valid [DuckDB interval part specifier](https://duckdb.org/docs/stable/sql/functions/datepart.html#part-specifiers-usable-as-date-part-specifiers-and-in-intervals), such as `30s`, `5m`, or `1h`. See [Setting custom database instance cache time (TTL)](/key-tasks/authenticating-and-connecting-to-motherduck/connecting-to-motherduck.md#setting-custom-database-instance-cache-time-ttl) for how instance caching works. ```bash duckdb 'md:my_db?dbinstance_inactivity_ttl=1h' ``` --- Source: https://motherduck.com/docs/sql-reference/wasm-client # MotherDuck Wasm client > Connect browser applications to MotherDuck using the DuckDB WebAssembly client and Hybrid Query Execution. [MotherDuck](https://motherduck.com/) is a managed DuckDB-in-the-cloud service. [DuckDB Wasm](https://github.com/duckdb/duckdb-wasm) brings DuckDB to every browser thanks to WebAssembly. The MotherDuck Wasm Client library enables using MotherDuck through DuckDB Wasm in your own browser applications. ## Examples Example projects and live demos can be found in the [wasm-client GitHub repository](https://github.com/motherduckdb/wasm-client). ## DuckDB version support - Each version of the MotherDuck Wasm Client library uses a specific version of DuckDB, as indicated by the package version. Check `pragma version` to see which DuckDB version is in use. ## Installation `npm install @motherduck/wasm-client` ## Dependencies The MotherDuck Wasm Client library depends on `apache-arrow` as a peer dependency. If you use `npm` version 7 or later to install `@motherduck/wasm-client`, then `apache-arrow` will automatically be installed, if it is not already. If you already have `apache-arrow` installed, then `@motherduck/wasm-client` will use it, as long as it is a compatible version (`^17.0.0` at the time of this writing). Optionally, you can use a variant of `@motherduck/wasm-client` that bundles `apache-arrow` instead of relying on it as a peer dependency. Don't use this option if you are using `apache-arrow` elsewhere in your application, because different copies of this library don't work together. To use this version, change your imports to: ```ts import '@motherduck/wasm-client/with-arrow'; ``` instead of: ```ts import '@motherduck/wasm-client'; ``` ## Usage The MotherDuck Wasm Client library is written in TypeScript and exposes full TypeScript type definitions. These instructions assume you are using it from TypeScript. Once you have installed `@motherduck/wasm-client`, you can import the main class, `MDConnection`, as follows: ```ts import { MDConnection } from '@motherduck/wasm-client'; ``` ### Creating connections To create a `connection` to a MotherDuck-connected DuckDB instance, call the `create` static method: ```ts const connection = MDConnection.create({ mdToken: token }); ``` The `mdToken` parameter is required and should be set to a valid MotherDuck access token. You can create a MotherDuck access token in the MotherDuck UI. For more information, see [Authenticating to MotherDuck](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck#authentication-using-an-access-token). The `create` call returns immediately, but starts the process of loading the DuckDB Wasm assets from `https://app.motherduck.com` and starting the DuckDB Wasm worker. This initialization process happens asynchronously. Any query evaluated before initialization is complete will be queued. To determine whether initialization is complete, call the `isInitialized` method, which returns a promise resolving to `true` when DuckDB Wasm is initialized: ```ts await connection.isInitialized(); ``` Multiple connections can be created. Connections share a DuckDB Wasm instance, so creating subsequent connections will not repeat the initialization process. Queries evaluated on different connections happen concurrently; queries evaluated on the same connection are queued sequentially. ### Evaluating queries To evaluate a query, call the `evaluateQuery` method on the `connection` object: ```ts try { const result = await connection.evaluateQuery(sql); console.log('query result', result); } catch (err) { console.log('query failed', err); } ``` The `evaluateQuery` method returns a [promise](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Promises) for the result. In an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/async_function), you can use the `await` syntax as above. Or, you can use the `then` and/or `catch` methods: ```ts connection.evaluateQuery(sql).then((result) => { console.log('query result', result); }).catch((reason) => { console.log('query failed', reason); }); ``` See [Results](#results) below for the structure of the result object. ### Prepared statements To create a [prepared](https://duckdb.org/docs/api/c/prepared) [statement](https://duckdb.org/docs/api/wasm/query#prepared-statements) for later evaluation, use the `prepareQuery` method: ```ts const prepareResult = await this.prepareQuery('SELECT v + ? FROM generate_series(0, 10000) AS t(v);'); ``` This returns an [AsyncPreparedStatement](https://shell.duckdb.org/docs/classes/index.AsyncPreparedStatement.html), which can be evaluated later using the `send` method: ```ts const arrowStream = await prepareResult.send(234); ``` Note: The `query` method of the AsyncPreparedStatement should not be used, because it can lead to deadlock when combined with the MotherDuck extension. To immediately evaluate a prepared statement, call the `evaluatePreparedStatement` method: ```ts const result = await connection.evaluatePreparedStatement('SELECT v + ? FROM generate_series(0, 10000) AS t(v);', [234]); ``` This returns a materialized result, as described in [Results](#results) below. ### Canceling queries To evaluate a query that can be canceled, use the `enqueueQuery` and `evaluateQueuedQuery` methods: ```ts const queryId = connection.enqueueQuery(sql); const result = await connection.evaluateQueuedQuery(queryId); ``` To cancel a query evaluated in this fashion, use the `cancelQuery` method, passing the `queryId` returned by `enqueueQuery`: ```ts const queryWasCanceled = await connection.cancelQuery(queryId); ``` The `cancelQuery` method returns a promise for a boolean indicating whether the query was successfully canceled. The result promise of a canceled query will be rejected with and error message. The `cancelQuery` method takes an optional second argument for controlling this message: ```ts const queryWasCanceled = await connection.cancelQuery(queryId, 'custom error message'); ``` ### Streaming results The query methods above return fully materialized results. To evaluate a query and return a stream of results, use `evaluateStreamingQuery` or `evaluateStreamingPreparedStatement`: ```ts const result = await connection.evaluateStreamingQuery(sql); ``` See [Results](#results) below for the structure of the result object. ### Error handling The query result promises returned by `evaluateQuery`, `evaluatePreparedStatement`, `evaluateQueuedQuery`, and `evaluateStreamingQuery` will be rejected in the case of an error. For convenience, "safe" variants of these three method are provided that catch this error and always resolve to a value indicating success or failure. For example: ```ts const result = await connection.safeEvaluateQuery(sql); if (result.status === 'success') { console.log('rows', result.rows); } else { console.log('error', result.err); } ``` ### Results A successful query result may either be fully materialized, or it may contain a stream. Use the `type` property of the result object, which is either `'materialized'` or `'streaming'`, to distinguish these. #### Materialized results A materialized result contains a `data` property, which provides several methods for getting the results. The number of columns and rows in the result are available through the `columnCount` and `rowCount` properties of `data`. Column names and types can be retrieved using the `columnName(columnIndex)` and `columnType(columnIndex)` methods. Individual values can be accessed using the `value(columnIndex, rowIndex)` method. See below for details about the forms values can take. Several convenience methods also simplify common access patterns; see `singleValue()`, `columnNames()`, `deduplicatedColumnNames()`, and `toRows()`. The `toRows()` method is especially useful in many cases. It returns the result as an array of row objects. Each row object has one property per column, named after that column. (Multiple columns with the same name are deduplicated with suffixes.) The type of each column property of a row object depends on the type of the corresponding column in DuckDB. Many values are converted to a JavaScript primitive type, such as `boolean`, `number`, or `string`. Some numeric values too large to fit in a JavaScript `number` (e.g a DuckDB [BIGINT](https://duckdb.org/docs/sql/data_types/numeric#integer-types)) are converted to a JavaScript `bigint`. Some DuckDB types, such as [DATE](https://duckdb.org/docs/sql/data_types/date), [TIME](https://duckdb.org/docs/sql/data_types/time), [TIMESTAMP](https://duckdb.org/docs/sql/data_types/timestamp), and [DECIMAL](https://duckdb.org/docs/sql/data_types/numeric#fixed-point-decimals), are converted to JavaScript objects implementing an interface specific to that type. Nested types such as DuckDB [LIST](https://duckdb.org/docs/sql/data_types/list), [MAP](https://duckdb.org/docs/sql/data_types/map), and [STRUCT](https://duckdb.org/docs/sql/data_types/struct) are also exposed through special JavaScript objects. These objects all implement `toString` to return a string representation. For primitive, this representation is identical to DuckDB's string conversion (e.g. using [CAST](https://duckdb.org/docs/sql/expressions/cast.html) to VARCHAR). For nested types, the representation is equivalent to the syntax used to construct these types. They also have properties exposing the underlying value. For example, the object for a DuckDB TIME has a `microseconds` property (of type `bigint`). See the TypeScript type definitions for details. Note that these result types differ from those returned by DuckDB Wasm without the MotherDuck Wasm Client library. The MotherDuck Wasm Client library implements custom conversion logic to preserve the full range of some types. #### Streaming results A streaming result contains three ways to consume the results, `arrowStream`, `dataStream`, and `dataReader`. The first two (`arrowStream` and `dataStream`) implement the async iterator protocol, and return items representing batches of rows, but return different kinds of batch objects. Batches correspond to DuckDB DataChunks, which are no more than 2048 rows. The third (`dataReader`) wraps `dataStream` and makes consuming multiple batches easier. The `dataStream` iterator returns a sequence of `data` objects, each of which implements the same interface as the `data` property of a materialized query result, described above. The `dataReader` implements the same `data` interface, but also adds useful methods such as `readAll` and `readUntil`, which can be used to read at least a given number of rows, possibly across multiple batches. The `arrowStream` property provides access to the underlying Arrow RecordBatch stream reader. This can be useful if you need the underlying Arrow representation. Also, this stream has convenience methods such as `readAll` to materialize all batches. Note, however, that Arrow performs sometimes lossy conversion of the underlying data to JavaScript types for certain DuckDB types, especially dates, times, and decimals. Also, converting Arrow values to strings will not always match DuckDB's string conversion. Note that results of remote queries are not streamed end-to-end yet. Results of remote queries are fully materialized on the client upstream of this API. So the first batch will not be returned from this API until all results have been received by the client. End-to-end streaming of remote query results is on our roadmap. ### DuckDB Wasm API To access the underlying DuckDB Wasm instance, use the `getAsyncDuckDb` function. Note that this function returns (a Promise to) a singleton instance of DuckDB Wasm also used by the MotherDuck Wasm Client. --- Source: https://motherduck.com/docs/sql-reference/postgres-endpoint # Postgres Endpoint > Connection parameters, SSL options, session settings, and limitations for the MotherDuck Postgres wire protocol endpoint MotherDuck's Postgres endpoint lets you query your databases using any client that speaks the [PostgreSQL wire protocol](https://www.postgresql.org/docs/current/protocol.html) — without installing a DuckDB client library. For a how-to guide on connecting, see [Connect through the Postgres endpoint](/key-tasks/authenticating-and-connecting-to-motherduck/postgres-endpoint). ## Connection parameters | Parameter | Value | |-----------|-------| | **Host** | `pg.-aws.motherduck.com` (for example, `pg.us-east-1-aws.motherduck.com`; find your region with [`md_user_info()`](/sql-reference/motherduck-sql-reference/md-user-info)) | | **Port** | `5432` | | **Database** | `md:`, or a specific database name | | **User** | `postgres` | | **Password** | Your [MotherDuck access token](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) | ## Connection string formats ```sh # psql PGPASSWORD=$MOTHERDUCK_TOKEN psql -h pg.us-east-1-aws.motherduck.com -p 5432 -U postgres "dbname=md: sslmode=verify-full sslrootcert=system" ``` ```sh # libpq URI postgresql://postgres:$MOTHERDUCK_TOKEN@pg.us-east-1-aws.motherduck.com:5432/md:?sslmode=verify-full&sslrootcert=system ``` ```sh # DSN keyword/value host=pg.us-east-1-aws.motherduck.com port=5432 dbname=md: user=postgres password=$MOTHERDUCK_TOKEN sslmode=verify-full sslrootcert=system ``` Use `md:` as the database name, or specify a database by name, for example `sample_data`. ## SSL and certificate verification The Postgres endpoint requires encrypted connections. For the best security, verify the server certificate. ### SSL modes | Mode | Encryption | Server verification | Recommendation | |------|-----------|-------------------|----------------| | `verify-full` | Yes | Yes | Recommended for production | | `require` | Yes | No | Fallback if certificate verification is not possible | ### Use the system certificate store (recommended) Set `sslmode=verify-full` with `sslrootcert=system` to use your operating system's trusted root certificates. This is supported in libpq 16 and later, and in libraries that wrap libpq (like psycopg v3). ```sh sslmode=verify-full sslrootcert=system ``` ### Use a specific certificate file If your client doesn't support `sslrootcert=system`, download the [ISRG Root X1](https://letsencrypt.org/certs/isrgrootx1.pem) certificate from Let's Encrypt and point your client to it: ```sh sslmode=verify-full sslrootcert=/path/to/isrgrootx1.pem ``` ### Library-specific SSL handling Some libraries have their own SSL implementations that don't use libpq directly: | Library | SSL behavior | Workaround | |---------|-------------|------------| | **psycopg (v3)** | Wraps libpq — `sslrootcert=system` works | None needed | | **psycopg2** | Bundles its own OpenSSL — `sslrootcert=system` is not supported | Use `sslrootcert=certifi.where()` with the `certifi` package | | **PostgreSQL JDBC** | Looks for `~/.postgresql/root.crt` by default | Set `sslfactory=org.postgresql.ssl.DefaultJavaSSLFactory` to use JVM trust store | | **node-postgres (`pg`)** | Reads `sslrootcert` as a file path — `system` causes `ENOENT` | Use config object: `ssl: { rejectUnauthorized: true }` | | **Cloudflare Workers (`pg-cloudflare`)** | TLS handled by the Workers runtime at the socket level — application-level verification settings are not exposed through the `pg` client | Use `?sslmode=require` in the connection string | ## Session options You can pass DuckDB session options using the `PGOPTIONS` environment variable: ```bash PGOPTIONS="--attach_mode=single --session_name=pg-using-options" psql -h pg.us-east-1-aws.motherduck.com -p 5432 -U postgres md: ``` | Option | Description | |--------|-------------| | `--attach_mode=single` | Only attach the specified database. Recommended when connecting from IDEs or BI tools to avoid seeing objects from other databases. See [Attach Modes](/key-tasks/authenticating-and-connecting-to-motherduck/attach-modes/). | ## Connection pooling and timeouts For production applications, use a connection pool and set client-side timeouts. Recommended starting points: | Setting | Starting point | Why | |---------|----------------|-----| | Connection acquire timeout | 30 seconds | Fails fast when no connection can be opened or checked out | | Maximum pool size | 5-10 connections per application instance | Caps how many queries the application runs concurrently | | Idle connection lifetime | 30-60 seconds | Recycles unused connections quickly | | Maximum connection lifetime | 10-30 minutes | Periodically replaces long-lived connections | | Query timeout | 60 seconds, or your application SLA | Cancels runaway queries before requests pile up | Always release checked-out connections back to the pool after use. If a connection sees a network, protocol, or server-termination error, discard it instead of returning it to the pool. SQL errors caused by a bad query do not always mean the underlying connection is unhealthy, but failed transactions should be rolled back before reuse. `statement_timeout` is not supported through the Postgres endpoint today. Do not rely on `SET statement_timeout`, `options=-c statement_timeout=...`, or startup options for query cancellation. Use your client library's timeout or cancellation feature instead, such as node-postgres `query_timeout`, JDBC `Statement.setQueryTimeout`, or a client-side cancel call in psycopg. ## Supported features and limitations ### DuckDB SQL, not PostgreSQL The Postgres endpoint is a PostgreSQL-wire interface to MotherDuck. You write **DuckDB SQL**, not PostgreSQL SQL. ### Best suited for - query execution against MotherDuck tables - DDL and DML that run entirely inside MotherDuck - metadata inspection - server-side reads from remote storage ### Use a DuckDB client path instead when you need - local-file workflows such as local-file `COPY`, `EXPORT DATABASE`, or `IMPORT DATABASE` - local or in-memory attachments such as `ATTACH ':memory:'` or `ATTACH '/path/to/file.duckdb'` - local execution paths such as `MD_RUN=LOCAL` - extension-based workflows such as `INSTALL`, `LOAD`, or cloud-storage `CREATE SECRET` - DuckDB-client session features such as `CREATE RESULT` ### Compatibility notes - PostgreSQL-specific features such as `pg_*` functions, PostgreSQL indexes, sequences, and stored procedures are not supported. - Transaction semantics follow the DuckDB model. Nested transactions are not supported. - Some commands are further restricted in PG server mode. For example, `SET threads` and `CREATE TEMP TABLE` are not supported through the Postgres endpoint. ### Operational limitations - **Configuration settings are restricted.** The Postgres endpoint connects in [SaaS mode](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck#authentication-using-saas-mode), a MotherDuck mode that blocks most DuckDB configuration changes after connecting and disables installing or loading extensions. Avoid using `SET` statements in your client code. - **IDE schema browsers may show extra objects.** Some IDEs display tables from all attached databases. Use `attach_mode=single` to scope the catalog to your target database. - **Use connection pooling in production.** Each connection consumes server resources. For applications that need many connections, use a connection pooler (for example, [Cloudflare Hyperdrive](https://developers.cloudflare.com/hyperdrive/), PgBouncer, or a language-native pool) rather than rapidly opening and closing connections. - **Third-party tool support is in early stages.** Check the [Integrations](/integrations/) page for tools that support the Postgres endpoint. --- Source: https://motherduck.com/docs/sql-reference/sql-reference # SQL reference > SQL reference for MotherDuck & DuckDB Complete SQL reference documentation for MotherDuck and DuckDB. This reference covers MotherDuck-specific SQL extensions, DuckDB's comprehensive SQL dialect, the Admin API for programmatic management, and the [remote MCP Server](/sql-reference/mcp/) for AI assistant integrations (and the [local MCP server](/sql-reference/mcp/#local-mcp-server) for self-hosted use). For practical examples and step-by-step instructions, see our [How-to Guides](/key-tasks/how-to-guides) and [Getting Started](/getting-started/) tutorials. ## Included pages - [MotherDuck REST API](https://motherduck.com/docs/sql-reference/rest-api/motherduck-rest-api): REST API reference for managing MotherDuck resources including databases, users, and access tokens. - [Command reference](https://motherduck.com/docs/sql-reference/motherduck-cli): Every MotherDuck CLI command with its arguments, options, output formats, and exit behavior. - [DuckDB SQL](https://motherduck.com/docs/sql-reference/duckdb-sql-reference): DuckDB SQL Reference - [MCP Server](https://motherduck.com/docs/sql-reference/mcp): Connect AI assistants to MotherDuck using the remote (fully managed) or local (fully customizable) MCP server - [Connection string parameters](https://motherduck.com/docs/sql-reference/connection-string-parameters): Reference for MotherDuck connection string parameters, including attach_mode, saas_mode, session_name, and dbinstance_inactivity_ttl. - [MotherDuck SQL](https://motherduck.com/docs/sql-reference/motherduck-sql-reference): MotherDuck-specific SQL extensions and cloud database management - [Wasm Client](https://motherduck.com/docs/sql-reference/wasm-client): Connect browser applications to MotherDuck using the DuckDB WebAssembly client and Hybrid Query Execution. - [Postgres Endpoint](https://motherduck.com/docs/sql-reference/postgres-endpoint): Connection parameters, SSL options, session settings, and limitations for the MotherDuck Postgres wire protocol endpoint --- ## Docs feedback MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`. For agents and automated tools, feedback submission should be user-confirmed before sending. URL-encode query parameter values and send a GET request: ```text GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fsql-reference%2F&page_title=MotherDuck%20Documentation%20-%20Reference&text= ``` Optionally append `&source=` such as `claude.ai` or `chatgpt`. `page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": ""}`, `400` for malformed query parameters, and `429` when rate-limited.