motherduck-duckdb-sql
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDuckDB SQL Reference for MotherDuck
面向MotherDuck的DuckDB SQL参考文档
Use this skill when you need exact DuckDB syntax, function behavior, or a quick sanity check that a statement will actually work on MotherDuck.
当你需要准确的DuckDB语法、函数行为,或快速验证某条语句是否能在MotherDuck上正常运行时,可使用本技能。
Source Of Truth
权威依据
- Prefer current DuckDB SQL docs for language features and function semantics.
- Use current MotherDuck SQL docs for MotherDuck-only commands such as shares, secrets, snapshots, and Dive operations.
- Check MotherDuck version-lifecycle docs for newly released DuckDB features before promising they are available in MotherDuck.
- Treat upstream DuckDB 1.5.x docs as ahead of MotherDuck unless the current MotherDuck lifecycle docs confirm the same DuckDB version and feature surface.
- Distinguish upstream DuckDB current-version docs from MotherDuck-supported DuckDB versions; MotherDuck can lag upstream current for client compatibility and SQL feature support.
- If the connection path matters, verify behavior against the current Postgres-endpoint docs before promising server-mode support.
- 优先参考最新的DuckDB SQL文档获取语言特性和函数语义相关内容。
- 如需了解仅MotherDuck支持的命令(如共享、密钥、快照和Dive操作),请查阅最新的MotherDuck SQL文档。
- 在承诺某DuckDB新特性可在MotherDuck中使用前,先查看MotherDuck版本生命周期文档。
- 除非当前MotherDuck生命周期文档确认其使用相同的DuckDB版本和功能范围,否则上游DuckDB 1.5.x文档的内容会领先于MotherDuck。
- 区分上游DuckDB当前版本文档与MotherDuck支持的DuckDB版本;出于客户端兼容性和SQL特性支持的考虑,MotherDuck的版本可能会滞后于上游当前版本。
- 如果连接路径会影响结果,在承诺支持服务器模式前,请根据最新的Postgres端点文档验证行为。
Default Posture
默认准则
- Write DuckDB SQL, not PostgreSQL SQL, even when the client connects through the Postgres endpoint.
- Use fully qualified names once more than one database or share is in scope.
"database"."schema"."table" - Prefer DuckDB-native constructs when they simplify the query: ,
GROUP BY ALL,QUALIFY,UNION BY NAME,arg_max, andEXCLUDE.REPLACE - When porting SQL from another engine, translate functions, date arithmetic, identifier quoting, and type casts explicitly instead of assuming compatibility.
- For upstream DuckDB 1.5 features such as , native
VARIANT,GEOMETRYreturn-type changes, ODBC scanner behavior, or lakehouse-format changes, verify current MotherDuck support before adding them to production guidance.date_trunc - Check whether the statement depends on local files, extension install/load, temporary-table behavior, or other client-only features before claiming it will work in MotherDuck.
- Treat snapshot, restore, and statements as operational SQL with plan-specific retention behavior, not ordinary analytical syntax.
UNDROP DATABASE - Treat MotherDuck SQL as an additional surface on top of DuckDB SQL, not a replacement for it.
- 编写DuckDB SQL而非PostgreSQL SQL,即使客户端通过Postgres端点连接。
- 当涉及多个数据库或共享资源时,使用完全限定的命名格式。
"database"."schema"."table" - 优先使用DuckDB原生结构简化查询:、
GROUP BY ALL、QUALIFY、UNION BY NAME、arg_max和EXCLUDE。REPLACE - 从其他引擎迁移SQL时,需显式转换函数、日期运算、标识符引用和类型转换,不要假设兼容性。
- 对于上游DuckDB 1.5的特性(如、原生
VARIANT、GEOMETRY返回类型变更、ODBC扫描器行为或湖仓格式变更),在将其纳入生产指导前,需验证MotherDuck当前是否支持。date_trunc - 在声明某语句可在MotherDuck中运行前,检查该语句是否依赖本地文件、扩展安装/加载、临时表行为或其他仅客户端支持的特性。
- 将快照、恢复和语句视为具有特定保留行为的运维SQL,而非普通分析语法。
UNDROP DATABASE - 将MotherDuck SQL视为DuckDB SQL的扩展,而非替代。
Workflow
工作流程
- Confirm the connection path and whether the question is about syntax, feature support, or a specific error.
- Write or repair the statement in DuckDB SQL first.
- Verify any MotherDuck-only command or server-mode limitation against the current docs.
- If the user needs exact syntax or function details, open .
references/SYNTAX_REFERENCE.md
- 确认连接路径,以及问题是关于语法、特性支持还是特定错误。
- 首先用DuckDB SQL编写或修正语句。
- 根据最新文档验证任何仅MotherDuck支持的命令或服务器模式限制。
- 如果用户需要准确的语法或函数细节,请打开。
references/SYNTAX_REFERENCE.md
Open Next
下一步操作
- for DuckDB data types, friendly SQL features, functions, complex types, and common MotherDuck-specific gotchas
references/SYNTAX_REFERENCE.md
- 如需了解DuckDB数据类型、易用SQL特性、函数、复杂类型以及常见MotherDuck特有问题,请查看
references/SYNTAX_REFERENCE.md
Related Skills
相关技能
- for writing and validating analytical SQL against live MotherDuck data
motherduck-query - when syntax support depends on PG endpoint versus native DuckDB behavior
motherduck-connect - when the problem is really missing schema context rather than missing syntax knowledge
motherduck-explore
- :用于针对MotherDuck实时数据编写和验证分析型SQL
motherduck-query - :当语法支持取决于PG端点与原生DuckDB行为的差异时使用
motherduck-connect - :当问题本质是缺少 schema 上下文而非语法知识时使用
motherduck-explore