datus-ai/datus-db-adapters/db-gaussdb-sql
- community
Checking that the SKILL.md file is still in the repository.
Generate and interpret GaussDB/openGauss SQL with PostgreSQL query syntax and A/B/PG compatibility modes. Read the task reference for distributed layout, upserts and transactions.
Install
npx vskill@latest install datus-ai/datus-db-adapters/db-gaussdb-sqlSKILL.md
GaussDB SQL
Generate GaussDB-compatible SQL from metadata-provided object and column names. Treat PostgreSQL 9.2 as the baseline syntax; GaussDB Kernel 50x and openGauss share this dialect. Use PostgreSQL-style query syntax in every database compatibility mode. Consult the write reference for supported upsert extensions.
Namespaces and identifiers
- Address objects in the connected database as
schema.table; usepubliconly when metadata or connection context selects it. There is no cross-database qualification. - Fold unquoted identifiers to lowercase. Preserve mixed case, reserved words, and special characters with double quotes; do not use backticks or square brackets.
- Avoid schema names reserved by GaussDB, including
dbe_*,pg_*,blockchain,snapshot,db4ai, andcstore.
Compatibility modes
- Each database runs in one compatibility mode:
A(Oracle, the common GaussDB default),B(MySQL), orPG. The mode changes semantics, not accepted syntax — keep generating PostgreSQL-style SQL in every mode. - In
Amode, the empty string and NULL are the same value: usecol IS NULL/col IS NOT NULLfor emptiness checks.col = ''never matches, and inserting''stores NULL. - In
Amode, string concatenation follows Oracle semantics:NULL || 'x'returns'x', not NULL. - Do not use Oracle-only functions or syntax (
nvl,decode,sysdate,add_months,(+)outer joins) even inAmode; use PostgreSQL equivalents (coalesce,CASE,current_timestamp, interval arithmetic, ANSI joins). - Prefer explicit casts (
CAST(x AS type)orx::type) —Amode implicit conversions differ from vanilla PostgreSQL, andDATEbehaves like a timestamp there. - In
Bmode,date1 - date2subtracts the dates as numbers (20240315 - 20240101 = 214), not as a day count. For a portable day difference in every mode useto_char(d1,'J')::int - to_char(d2,'J')::int;DATEDIFFexists only inBmode. - In
Bmode, NULLs sort first ascending (opposite of PostgreSQL). When NULL placement matters — especially beforeLIMIT— always spell it out:ORDER BY col NULLS LAST(orNULLS FIRST). - In
Bmode,extract(week ...)uses MySQL week numbering; useto_char(d,'IW')for ISO week in every mode. - In
Bmode, boolean values render as'1'/'0'and aggregates over an empty set may not be NULL. For text output of booleans compare explicitly (CASE WHEN flag THEN ...) instead of relying on the rendering.
Queries and types
- Use PostgreSQL-style
LIMITandOFFSET, ANSI joins, window functions, and CTEs. - Prefer
TEXTfor unbounded strings andVARCHAR(n)only when a length bound is meaningful. - Use GaussDB-supported PostgreSQL types such as
SMALLINT,INTEGER,BIGINT,NUMERIC,REAL,DOUBLE PRECISION,BOOLEAN,TEXT,BYTEA,DATE,TIMESTAMP, andTIMESTAMPTZaccording to metadata. - Treat PostgreSQL features newer than 9.2 as version-dependent:
to_regclass,FILTERaggregate clauses,LATERAL, andON CONFLICTare not universally available.ON CONFLICTadditionally requires PG compatibility. Confirm support before generating them.
Avoid common dialect leaks
Before returning SQL, reject MySQL backticks and table options, Oracle-only functions and (+) joins, Snowflake three-part names, unguarded ON CONFLICT, and = '' emptiness checks that break under A mode.
Existing distributed layout
Use the metadata's deployment type and distribution keys. Prefer joins and GROUP BY on distribution keys to reduce cross-node shuffling; a distribution key alone does not establish a unique row.
Task references
- GaussDB distributed layout and writes: physical distribution choices, writes, upserts and transactions.
Read these for the requested operation, including SQL-only authoring. Supplied ETL is evidence; follow the user's task.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdatus-gaussdb/datus_gaussdb/skills/db-gaussdb-sql/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/datus-ai/datus-db-adapters/db-gaussdb-sql)