PostgreSQL Error Code (SQLSTATE) Lookup

Paste a five-character PostgreSQL SQLSTATE such as 23505 or 42P01, or just the error text your application logged - duplicate key value violates unique constraint, relation does not exist, deadlock detected, too many clients - and this tool identifies the condition, explains why PostgreSQL raised it, and gives a concrete fix with the SQL to run. It also lists the matching exception class or code for psycopg, JDBC, node-postgres, pgx, lib/pq and Npgsql, and generates ready-to-paste catch blocks for each of them. The lookup understands psql output, Java stack traces and Python tracebacks, and falls back to keyword matching when no code is present. Everything runs entirely in your browser: nothing you paste is sent anywhere.

Common codes:

Do more than postgresql error code (sqlstate) lookup — meet Chat2DB

Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.

PostgreSQL SQLSTATE reference table (129 codes by class)

Every PostgreSQL error carries a five-character SQLSTATE. The first two characters are the class (23 = integrity constraint violation, 42 = syntax or access rule, 08 = connection, 53 = resources, XX = internal) and the last three identify the specific condition. Codes ending in 000 are the generic condition for their class; codes containing P are PostgreSQL-specific extensions to the SQL standard. The condition names in the second column are what you use in PL/pgSQL EXCEPTION WHEN clauses, and psycopg derives its exception class names from them (unique_violation becomes psycopg.errors.UniqueViolation). Click any code to load it into the tool above.

Class 20Case Not Found

a PL/pgSQL CASE statement had no matching WHEN branch and no ELSE.

SQLSTATECondition nameMeaning
case_not_foundPL/pgSQL CASE statement without matching WHEN / ELSE.

Class 21Cardinality Violation

a query that must return exactly one row returned several.

SQLSTATECondition nameMeaning
cardinality_violationSubquery used as a scalar returned more than one row.

Class 22Data Exception

a value cannot be represented in the target type - bad input syntax, overflow, truncation, division by zero.

SQLSTATECondition nameMeaning
data_exceptionGeneric data conversion problem.
string_data_right_truncationValue longer than the column's varchar(n)/char(n).
numeric_value_out_of_rangeNumber does not fit the target type / precision.
null_value_not_allowedNULL passed where a value is required.
invalid_datetime_formatString is not a valid date/time literal.
datetime_field_overflowDate/time field value out of range (e.g. Feb 30).
division_by_zeroDivision or modulo by zero.
character_not_in_repertoireByte sequence invalid for the database encoding.
invalid_parameter_valueArgument value not accepted by the function.
invalid_escape_sequenceBad LIKE / string escape.
string_data_length_mismatchBit string length does not match bit(n).
invalid_regular_expressionMalformed regular expression.
array_subscript_errorArray index or dimension problem.
invalid_text_representationString cannot be parsed as the target type (int, uuid, json...).
invalid_binary_representationBad binary-format bind parameter.
bad_copy_file_formatCOPY input has wrong number of columns / bad format.
untranslatable_characterCharacter has no equivalent in the client encoding.

Class 23Integrity Constraint Violation

a row violates a PRIMARY KEY, UNIQUE, FOREIGN KEY, NOT NULL, CHECK or EXCLUDE constraint; only the statement is rolled back.

SQLSTATECondition nameMeaning
integrity_constraint_violationGeneric constraint violation.
restrict_violationON DELETE/UPDATE RESTRICT foreign key blocked the change.
not_null_violationNULL inserted into a NOT NULL column.
foreign_key_violationRow references a parent that does not exist, or parent still referenced.
unique_violationDuplicate value for a PRIMARY KEY or UNIQUE constraint/index.
check_violationRow fails a CHECK constraint or domain check.
exclusion_violationRow conflicts with an EXCLUDE constraint (e.g. overlapping ranges).

Class 24Invalid Cursor State

a cursor was used while not positioned on a row or after it was closed.

SQLSTATECondition nameMeaning
invalid_cursor_stateCursor not positioned on a row / already closed.

Class 25Invalid Transaction State

the command is not allowed in the current transaction state (aborted, read-only, inside a transaction block, etc.).

SQLSTATECondition nameMeaning
invalid_transaction_stateCommand not allowed in the current transaction state.
active_sql_transactionCommand cannot run inside a transaction block.
read_only_sql_transactionWrite attempted on a read-only transaction or hot standby.
no_active_sql_transactionSAVEPOINT / COMMIT without an open transaction.
in_failed_sql_transactionTransaction is aborted; every command is ignored until ROLLBACK.
idle_in_transaction_session_timeoutSession sat idle inside a transaction too long.

Class 26Invalid SQL Statement Name

a prepared statement name is unknown to this connection - classic with connection poolers.

SQLSTATECondition nameMeaning
invalid_sql_statement_namePrepared statement not found (pooler / reconnect).

Class 27Triggered Data Change Violation

a trigger tried to modify a row that the same command is already modifying.

SQLSTATECondition nameMeaning
triggered_data_change_violationTrigger modified a row the same command is changing.

Class 28Invalid Authorization Specification

authentication failed - wrong password, unknown role or no matching pg_hba.conf rule.

SQLSTATECondition nameMeaning
invalid_authorization_specificationAuthentication rejected: no pg_hba rule or unknown role.
invalid_passwordWrong password for the role.

Class 34Invalid Cursor Name

the named cursor or portal does not exist on this connection.

SQLSTATECondition nameMeaning
invalid_cursor_nameNamed cursor / portal does not exist.

Class 38External Routine Exception

an external-language (C, PL/Python, PL/Perl...) function did something it is not allowed to do.

SQLSTATECondition nameMeaning
external_routine_exceptionExternal-language function misbehaved.

Class 39External Routine Invocation Exception

an external function or trigger returned something PostgreSQL did not expect.

SQLSTATECondition nameMeaning
trigger_protocol_violatedTrigger function returned something invalid.

Class 40Transaction Rollback

the whole transaction was rolled back by the server (deadlock, serialization failure) - retry it.

SQLSTATECondition nameMeaning
transaction_rollbackTransaction rolled back by the server (generic).
serialization_failureTransaction conflicts under REPEATABLE READ / SERIALIZABLE; retry.
statement_completion_unknownConnection lost after sending a statement - unknown whether it committed.
deadlock_detectedTwo transactions wait on each other's locks; one is aborted.

Class 42Syntax Error or Access Rule Violation

the SQL text is wrong, references an unknown object, or the role lacks the privilege.

SQLSTATECondition nameMeaning
syntax_error_or_access_rule_violationGeneric syntax / access rule problem.
insufficient_privilegeRole lacks the privilege (permission denied).
syntax_errorSQL text could not be parsed.
duplicate_columnColumn already exists on the table.
ambiguous_columnColumn name exists in more than one table of the query.
undefined_columnColumn does not exist (typo, case, wrong table).
undefined_objectType, role, extension, constraint or other object does not exist.
duplicate_objectObject (role, type, index, extension...) already exists.
ambiguous_functionSeveral function overloads match the call.
grouping_errorColumn must appear in GROUP BY or an aggregate.
datatype_mismatchExpression type does not match the target column / RETURN type.
wrong_object_typeCommand applied to the wrong kind of object (view vs table, index...).
cannot_coerceNo cast exists between the two types.
undefined_functionNo function/operator with matching name and argument types.
reserved_nameName is reserved (pg_ prefix).
undefined_tableTable / view / relation does not exist.
undefined_parameter$n placeholder without a bound value.
duplicate_prepared_statementPrepared statement name already in use on the backend.
duplicate_tableTable / relation already exists.
ambiguous_parameterSame $n used with conflicting types.
invalid_column_referenceON CONFLICT target has no matching unique index, or bad column reference.
invalid_table_definitionCREATE / ALTER TABLE definition is invalid.
indeterminate_datatypeType of a parameter or NULL literal cannot be inferred.

Class 44WITH CHECK OPTION Violation

a row written through a view would not be visible through that view.

SQLSTATECondition nameMeaning
with_check_option_violationRow written through a view would not be visible in it.

Class 53Insufficient Resources

the server ran out of memory, disk, connections or a configured limit.

SQLSTATECondition nameMeaning
insufficient_resourcesServer out of some resource (generic).
disk_fullNo space left on device.
out_of_memoryBackend or shared memory allocation failed.
too_many_connectionsmax_connections reached.
configuration_limit_exceededA configured limit such as temp_file_limit was exceeded.

Class 54Program Limit Exceeded

a hard PostgreSQL limit was hit (stack depth, argument count, index row size).

SQLSTATECondition nameMeaning
program_limit_exceededA hard PostgreSQL size limit was hit (index row, jsonb...).
statement_too_complexStack depth limit exceeded (deep recursion / expression).
too_many_columnsTable would exceed 1600 columns.
too_many_argumentsFunction call with more than 100 arguments.

Class 55Object Not In Prerequisite State

the object exists but is not in the right state for this operation (locked, in use, not yet committed).

SQLSTATECondition nameMeaning
object_not_in_prerequisite_stateObject exists but is in the wrong state for the operation.
object_in_useObject is being used by other sessions (DROP DATABASE etc.).
cant_change_runtime_paramSetting cannot be changed now / needs a restart.
lock_not_availableNOWAIT / lock_timeout could not obtain the lock.
unsafe_new_enum_value_usageNew enum value used before its transaction committed.

Class 57Operator Intervention

an administrator, a timeout or a server shutdown interrupted the session.

SQLSTATECondition nameMeaning
operator_interventionSession interrupted by an operator / shutdown (generic).
query_canceledStatement cancelled: statement_timeout or pg_cancel_backend.
admin_shutdownServer shutting down or backend terminated by admin.
crash_shutdownAnother backend crashed; all sessions were reset.
cannot_connect_nowServer is starting up, shutting down or in recovery.
idle_session_timeoutSession idle (outside a transaction) longer than idle_session_timeout.

Class 58System Error

the operating system reported an error (file missing, I/O failure) - errors external to PostgreSQL itself.

SQLSTATECondition nameMeaning
system_errorOperating-system level error (generic).
io_errorRead/write to a data file failed.
undefined_fileA file the server needs is missing (extension, tablespace, data file).
duplicate_fileA file the server wanted to create already exists.

Class 72Snapshot Failure

old_snapshot_threshold pruned data the long-running query still needed.

SQLSTATECondition nameMeaning
snapshot_too_oldold_snapshot_threshold pruned data the query needed.

Class 00Successful Completion

not an error - the statement completed normally.

SQLSTATECondition nameMeaning
successful_completionStatement completed normally.

Class 01Warning

the statement succeeded but PostgreSQL wants you to know about something (truncation, deprecated feature, etc.).

SQLSTATECondition nameMeaning
warningGeneric warning; statement still succeeded.

Class 02No Data

a completion condition, not an error - the statement produced no rows.

SQLSTATECondition nameMeaning
no_dataStatement returned no rows (completion condition).

Class 03SQL Statement Not Yet Complete

the statement is still executing (mostly seen in asynchronous or pipelined drivers).

SQLSTATECondition nameMeaning
sql_statement_not_yet_completeStatement still executing (async / pipeline drivers).

Class 08Connection Exception

the network connection to the server could not be opened, was closed, or the wire protocol was violated.

SQLSTATECondition nameMeaning
connection_exceptionGeneric connection problem.
sqlclient_unable_to_establish_sqlconnectionClient could not open a connection (refused, timeout, DNS).
connection_does_not_existOperation used a connection that is already closed.
connection_failureEstablished connection was lost mid-session.
protocol_violationClient and server disagree on the wire protocol.

Class 09Triggered Action Exception

an action fired by a trigger failed.

SQLSTATECondition nameMeaning
triggered_action_exceptionAction fired by a trigger failed.

Class 0AFeature Not Supported

the syntax is valid SQL but this PostgreSQL version (or this object type) does not implement it.

SQLSTATECondition nameMeaning
feature_not_supportedValid SQL that this PostgreSQL version does not implement.

Class 0BInvalid Transaction Initiation

a transaction was started in a context where that is not allowed.

SQLSTATECondition nameMeaning
invalid_transaction_initiationTransaction started where not allowed.

Class 0FLocator Exception

an invalid large-object / locator reference was used.

SQLSTATECondition nameMeaning
locator_exceptionInvalid large-object locator.

Class 0LInvalid Grantor

GRANT / REVOKE was attempted by a role that cannot grant that privilege.

SQLSTATECondition nameMeaning
invalid_grantorGrantor cannot grant this privilege.

Class 0PInvalid Role Specification

a role name is not valid in this context.

SQLSTATECondition nameMeaning
invalid_role_specificationRole name not valid in this context.

Class 0ZDiagnostics Exception

GET DIAGNOSTICS / GET STACKED DIAGNOSTICS was used incorrectly.

SQLSTATECondition nameMeaning
diagnostics_exceptionGET DIAGNOSTICS misuse.

Class 2BDependent Privilege Descriptors Still Exist

an object cannot be dropped because other objects or privileges depend on it.

SQLSTATECondition nameMeaning
dependent_objects_still_existDROP blocked by dependent views, FKs, functions.

Class 2DInvalid Transaction Termination

COMMIT / ROLLBACK was issued where transaction control is not allowed (functions, sub-transactions).

SQLSTATECondition nameMeaning
invalid_transaction_terminationCOMMIT/ROLLBACK inside a function or sub-transaction.

Class 2FSQL Routine Exception

a SQL-language or PL/pgSQL function misbehaved (missing RETURN, forbidden statement).

SQLSTATECondition nameMeaning
sql_routine_exceptionSQL-language / PL function violated its declaration.
function_executed_no_return_statementPL/pgSQL function ended without RETURN.

Class 3BSavepoint Exception

a savepoint name is invalid or unknown.

SQLSTATECondition nameMeaning
savepoint_exceptionSavepoint problem.
invalid_savepoint_specificationROLLBACK TO / RELEASE a savepoint that does not exist.

Class 3DInvalid Catalog Name

the database named in the connection string does not exist.

SQLSTATECondition nameMeaning
invalid_catalog_nameDatabase named in the connection does not exist.

Class 3FInvalid Schema Name

the schema does not exist or no schema was selected for CREATE.

SQLSTATECondition nameMeaning
invalid_schema_nameSchema does not exist / no schema selected for CREATE.

Class F0Configuration File Error

postgresql.conf / pg_hba.conf could not be read or contains errors.

SQLSTATECondition nameMeaning
config_file_errorpostgresql.conf / pg_hba.conf has errors.
lock_file_existspostmaster.pid exists - another server may be running.

Class HVForeign Data Wrapper Error (SQL/MED)

a foreign data wrapper such as postgres_fdw or file_fdw failed.

SQLSTATECondition nameMeaning
fdw_errorGeneric foreign data wrapper error.
fdw_unable_to_establish_connectionpostgres_fdw could not connect to the remote server.

Class P0PL/pgSQL Error

raised from PL/pgSQL code - RAISE EXCEPTION, STRICT SELECT INTO, ASSERT.

SQLSTATECondition nameMeaning
plpgsql_errorGeneric PL/pgSQL error.
raise_exceptionCustom RAISE EXCEPTION from PL/pgSQL.
no_data_foundSELECT ... INTO STRICT returned no rows.
too_many_rowsSELECT ... INTO STRICT returned more than one row.
assert_failurePL/pgSQL ASSERT condition was false.

Class XXInternal Error

a bug or data corruption inside PostgreSQL - check the server log and run pg_amcheck.

SQLSTATECondition nameMeaning
internal_errorUnexpected internal error (bug, corruption, extension crash).
data_corruptedData file page is corrupt.
index_corruptedIndex structure is corrupt; REINDEX.

How to find the SQLSTATE of a PostgreSQL error

  • psql: run \set VERBOSITY verbose and every error prints an extra SQLSTATE: line; \errverbose re-prints the last error in full.
  • Server log: set log_error_verbosity = verbose, or use log_line_prefix = '%e' to include the SQLSTATE in every log line.
  • Python: e.sqlstate (psycopg 3) or e.pgcode (psycopg2); the exception class itself already names the condition.
  • Java: SQLException.getSQLState(); the PSQLException message also shows the server message and, with getServerErrorMessage(), the DETAIL / HINT fields.
  • Node.js: err.code, plus err.detail, err.constraint, err.table, err.column.
  • Go: pgconn.PgError.Code (pgx) or pq.Error.Code (lib/pq), with Code.Name() returning the condition name.
  • PL/pgSQL: inside an EXCEPTION block the variables SQLSTATE and SQLERRM are set, and GET STACKED DIAGNOSTICS exposes DETAIL, HINT, constraint and table names.

How to use

  1. Paste a SQLSTATE code (23505, 42P01, 57014...) or the error message itself - including psql output, a psycopg2.errors.UniqueViolation traceback line or a PSQLException message - into the input box, or click one of the common codes.
  2. Read the report: condition name, class meaning, the typical server message, why it happens, and the fix with SQL or configuration commands. For free-text input the best match is shown first with up to four alternatives.
  3. Copy the 'Handle it in code' snippet to catch exactly that condition in PL/pgSQL, Python, Java, Node.js or Go, and use the reference table below to browse every class.

Frequently asked questions

What is a PostgreSQL SQLSTATE code and how is it different from the error message?

SQLSTATE is a five-character code defined by the SQL standard (with PostgreSQL-specific additions containing the letter P). The first two characters name the class - 23 for integrity constraint violations, 42 for syntax or privilege problems, 08 for connection failures, 40 for transaction rollbacks - and the last three identify the exact condition, for example 23505 unique_violation. Unlike the human-readable message, which changes between versions and translations and embeds table or constraint names, the SQLSTATE is stable, so application code should branch on it (err.code, getSQLState(), e.sqlstate) rather than on message text.

Which PostgreSQL errors should my application retry automatically?

Class 40 errors are designed to be retried: 40001 serialization_failure and 40P01 deadlock_detected mean the server already rolled the transaction back and a fresh attempt will usually succeed - retry the whole transaction with a short back-off. Connection-level failures (08006 connection_failure, 57P01 admin_shutdown, 57P03 cannot_connect_now) should be retried on a new connection. Do not blindly retry class 23 constraint violations, class 42 syntax or privilege errors or class 22 data errors: they will fail identically until the data or SQL is fixed. 40003 statement_completion_unknown needs an idempotency check first because the commit may have succeeded.

How do I see which statement produced a SQLSTATE and debug it against the database?

In psql, \set VERBOSITY verbose prints the SQLSTATE, and \errverbose re-shows the last error with DETAIL, HINT and the source location. In the server log, log_error_verbosity = verbose or %e in log_line_prefix records it for every failure. To see the failing statement, the SQLSTATE and the affected table side by side against a live database - and to have AI explain the error and propose the corrected SQL - use Chat2DB: download the desktop client at https://chat2db.ai/download or open the web app at https://app.chat2db.ai, run the statement, and inspect the constraint, index or permission the error refers to without leaving the editor.

More free SQL tools

SQL Formatter & Beautifier
Format and beautify SQL queries online with dialect-aware indentation and keyword casing.
SQL Validator & Syntax Checker
Check SQL syntax online for MySQL, PostgreSQL and more, with clear error messages.
SQL Minifier
Minify SQL by stripping comments and collapsing whitespace into a single line.
MySQL to PostgreSQL Converter
Convert MySQL DDL and queries to PostgreSQL syntax with a best-effort dialect translator.
CSV to SQL Converter
Turn CSV, TSV or pasted Excel data into SQL INSERT statements.
JSON to SQL Converter
Convert a JSON array of objects into SQL INSERT statements.
SQL IN Clause Generator
Paste a list of values and get a ready-to-use SQL IN (...) clause.
SQL Escape & Unescape
Escape single quotes and special characters for safe SQL string literals.
JDBC Connection String Builder
Build JDBC URLs for MySQL, PostgreSQL, SQL Server, Oracle, MariaDB and ClickHouse.
SQL Cheat Sheet
A practical SQL reference: joins, aggregation, window functions, DDL and dialect differences.
UUID Generator (v4 & v7)
Generate UUID v4 and time-ordered UUID v7 in bulk, as plain text, JSON, CSV or SQL.
Cron Expression Generator & Validator
Build and validate cron expressions with plain-English explanations and next run times.
PostgreSQL EXPLAIN Plan Visualizer
Turn EXPLAIN ANALYZE output into a readable plan tree with timings and tuning warnings.
PgBouncer Config Generator
Generate pgbouncer.ini and size connection pools from your app instances and CPU cores.
PostgreSQL Partition Table Generator
Generate RANGE, LIST and HASH partitioning DDL with child partitions and maintenance SQL.
pg_dump Command Generator
Build pg_dump and pg_restore commands with format, filter and parallel job options.
mysqldump Command Generator
Build mysqldump backup commands with scope, options and a matching restore command.
SQL Test Data Generator
Generate realistic fake rows as SQL INSERT statements, CSV or JSON, right in your browser.
PostgreSQL Config Calculator
Calculate tuned postgresql.conf settings from your RAM, CPU cores, connections and workload.
SQL DDL to Code Generator
Convert CREATE TABLE statements into TypeScript, Prisma, Drizzle, Go, JPA or SQLAlchemy models.
SQL Window Function Generator
Build ROW_NUMBER, RANK, LAG, LEAD and running-total OVER() clauses with PARTITION BY and frames.
Docker Compose PostgreSQL Generator
Generate a docker-compose.yml for PostgreSQL with volumes, healthchecks, init scripts and pgAdmin.
PostgreSQL Replication Config Generator
Generate streaming and logical replication config: postgresql.conf, pg_hba.conf, slots and pg_basebackup.
SQL Injection Checker
Scan code for SQL injection risks and rewrite unsafe queries with bound parameters.
SQL to ER Diagram Generator
Paste CREATE TABLE DDL and get an entity relationship diagram plus Mermaid erDiagram code.
Postgres Connection String Generator
Build PostgreSQL connection strings: libpq URI, DSN, JDBC, psycopg, SQLAlchemy, Npgsql and .env.
Postgres GRANT Statement Generator
Generate PostgreSQL GRANT, ALTER DEFAULT PRIVILEGES and REVOKE scripts for read-only or read-write roles.
Postgres COPY Command Generator
Build PostgreSQL COPY and psql \copy commands to import or export CSV with HEADER, DELIMITER, NULL and WHERE options.
Postgres CREATE INDEX Generator
Generate PostgreSQL CREATE INDEX statements: B-tree, GIN, GiST, BRIN, UNIQUE, CONCURRENTLY, partial WHERE, INCLUDE and expression indexes.
Postgres TO_CHAR Date Format Builder
Build PostgreSQL TO_CHAR date format patterns with live preview, presets and generated TO_CHAR / TO_TIMESTAMP statements.
Postgres FDW Setup Generator
Generate postgres_fdw CREATE SERVER, USER MAPPING and IMPORT FOREIGN SCHEMA SQL for querying a remote Postgres database.
Postgres EXCLUDE Constraint Generator
Generate PostgreSQL EXCLUDE constraint SQL: GiST/SP-GiST operators, btree_gist columns, partial WHERE and overlap-check verification.
pgvector Index & Schema Generator
Generate pgvector SQL: vector/halfvec columns, HNSW or IVFFlat indexes, tuned parameters and the matching nearest-neighbour query.
Postgres ALTER COLUMN TYPE Generator
Generate ALTER TABLE ALTER COLUMN TYPE SQL with the right USING cast, a table-rewrite verdict and a batched zero-downtime migration.
Postgres UPSERT Generator
Build INSERT ... ON CONFLICT DO UPDATE/DO NOTHING statements, the MERGE equivalent and the unique index they need.
pg_hba.conf Generator
Generate PostgreSQL client authentication rules with the right connection type, CIDR and auth method.
Postgres Trigger Generator
Generate CREATE TRIGGER SQL and plpgsql trigger functions: updated_at touch, JSONB audit log, operation guards and TG_OP skeletons.
Postgres VACUUM Command Generator
Build VACUUM / VACUUM FULL / ANALYZE commands with the right options, plus monitoring SQL and per-table autovacuum tuning.
SQL Pivot Generator (Rows to Columns)
Generate pivot queries with FILTER or CASE WHEN aggregates, the PostgreSQL crosstab() version and the reverse unpivot.
Epoch & Unix Timestamp Converter
Convert epoch to date and back with auto unit detection, plus to_timestamp and extract(epoch) SQL snippets.
pg_restore Command Generator
Build pg_restore or psql restore commands from a Postgres dump: archive format, parallel jobs, clean, no-owner and single-transaction options.
Postgres JSONB Query Builder
Generate JSONB queries from a nested path and operator, with the matching GIN or expression index and a JSONB cookbook.
SQL Schema Diff & Migration Generator
Compare two SQL schemas and generate the ALTER TABLE up and down migration, with lock and rewrite warnings.
Postgres Table Size Estimator
Estimate table and index size from your columns and row count, including tuple header, alignment padding and column-order savings.
Postgres Full Text Search Generator
Generate tsvector columns, GIN indexes, weighted ranking and ts_headline queries for PostgreSQL full text search.
Levenshtein Distance Calculator
Compute edit distance between two strings with the full DP matrix, edit path and matching Postgres fuzzy search SQL.
SQL Linter & Style Checker
Lint SQL for correctness traps, non-sargable predicates and style issues in your browser.
Database Normalization Analyzer
Find candidate keys and 1NF/2NF/3NF/BCNF violations, then get a lossless decomposition.
Connection Pool Size Calculator
Size your database connection pool from cores, latency and instances, with HikariCP, pgxpool, node-pg, SQLAlchemy and PgBouncer config.
Postgres Autovacuum Calculator
Work out when autovacuum fires on a table, how much bloat builds up first, and generate per-table ALTER TABLE tuning.
SQL to MongoDB Query Converter
Convert a SQL SELECT into a MongoDB find() call or aggregation pipeline, with $lookup, $group, $match and $sort mapping.
pgloader Config Generator
Build a pgloader .load file to migrate MySQL, SQL Server, SQLite or CSV into PostgreSQL, with cast rules, table filters and verification SQL.
Postgres Upgrade Planner
Compare pg_upgrade, dump/restore and logical replication for a major version upgrade, with downtime estimates, commands and breaking changes.
SQL Join Visualizer
See INNER, LEFT, RIGHT, FULL, CROSS and anti joins run on real sample rows, with the SQL.
SCD Type 2 SQL Generator
Generate slowly changing dimension Type 2 DDL and load SQL for Postgres, Snowflake and BigQuery.
Postgres RLS Policy Generator
Generate PostgreSQL row level security policies for multi-tenant, per-user or role-based access.
Postgres Data Masking Generator
Build masked views, anonymization UPDATEs or PostgreSQL Anonymizer labels for sensitive columns.
Online SQL Playground
Run SQL in your browser against a sample SQLite database, with 10 checked practice exercises.
SQL CASE WHEN Generator
Build searched or simple CASE expressions with full queries and IF/IIF/DECODE equivalents per dialect.
SQL Set Operations Visualizer
See UNION, UNION ALL, INTERSECT and EXCEPT run on real rows, with counts and SQL per dialect.
Postgres Enum Type Generator
Generate CREATE TYPE, ADD VALUE, RENAME VALUE, safe value removal and enum-to-CHECK or lookup migrations.
Postgres Lock Conflict Checker
Check whether two PostgreSQL statements or LOCK TABLE modes block each other, with the conflict matrix and pg_locks queries.
Postgres Timezone Converter
Convert timestamps between IANA zones and generate AT TIME ZONE, SET timezone and date_trunc SQL with DST warnings.
Slow Query Log Analyzer
Group a MySQL or PostgreSQL slow query log by normalized query shape and rank the shapes by total time.
Postgres generate_series Builder
Build generate_series SQL for calendar tables, time buckets, gap-filled reports and test data, with a row preview.
Postgres Index Type Advisor
Pick between B-tree, Hash, GIN, GiST, SP-GiST, BRIN and HNSW for a column and query pattern, with the CREATE INDEX statement and operator class.
Postgres SERIAL to IDENTITY Converter
Convert a SERIAL or BIGSERIAL column to GENERATED AS IDENTITY with the correct setval, rollback and optional bigint widening.
Postgres DROP ROLE Helper
Generate the audit queries, REASSIGN OWNED, DROP OWNED and DROP ROLE script that clears "role cannot be dropped" errors.
pg_stat_statements Query Builder
Build version-correct Top-N pg_stat_statements queries by total time, mean time, calls, cache misses, temp spills or WAL.
AWS DMS Table Mapping Generator
Build a valid AWS DMS table-mappings.json with selection rules, schema and table renames, column removal and source row filters.
ClickHouse MergeTree Table Generator
Generate ClickHouse CREATE TABLE DDL with MergeTree engines, sorting keys, partitioning, TTL and compression codecs.
SQL Server to PostgreSQL Converter
Translate T-SQL DDL and queries to PostgreSQL: brackets, IDENTITY, NVARCHAR, TOP, GETDATE and more.
Docker Compose MySQL & MariaDB Generator
Generate docker-compose.yml for MySQL or MariaDB with volumes, healthchecks, init scripts and phpMyAdmin.
Oracle to PostgreSQL Converter
Translate Oracle DDL and SQL to PostgreSQL: VARCHAR2, NUMBER, NVL, DECODE, SYSDATE, sequences and more.
SQL Server Backup & Restore Command Generator
Generate T-SQL BACKUP and RESTORE scripts with compression, checksum, WITH MOVE, STOPAT and sqlcmd.
pgbench Command Generator
Build pgbench init and benchmark command lines for PostgreSQL load testing.
dbt schema.yml Generator
Turn a CREATE TABLE statement into a dbt schema.yml with data tests and a unit test skeleton.
DBML to SQL Converter
Convert DBML schemas to PostgreSQL or MySQL DDL, and turn existing CREATE TABLE statements back into DBML.
Liquibase Changelog Generator
Turn SQL DDL into a Liquibase changelog in XML, YAML, JSON or formatted SQL, with constraints and rollbacks.
MySQL Config Calculator
Generate a tuned my.cnf from your RAM, cores and workload, with an InnoDB memory budget check.
Debezium Connector Config Generator
Build a Debezium CDC connector config for PostgreSQL, MySQL, SQL Server, Oracle or MongoDB.
MongoDB Connection String Builder
Build or parse mongodb:// and mongodb+srv:// URIs with encoded passwords, auth and replica set options.
MySQL GRANT Statement Generator
Generate MySQL 8 CREATE USER, GRANT, role and REVOKE scripts for read-only, read-write or replication users.
OtterMind
OtterMind