Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
10
28
split
stringclasses
1 value
sql
stringlengths
15
114
expected_rule_ids
listlengths
0
2
blocked
bool
2 classes
note
stringlengths
31
68
safe_create_table
train
CREATE TABLE invoices (id BIGINT PRIMARY KEY, total_cents BIGINT);
[]
false
Additive table creation; no configured heuristic fires.
drop_column
train
ALTER TABLE accounts DROP COLUMN legacy_email;
[ "PG001", "PG002" ]
true
Destructive column removal during a possible rolling deploy.
drop_table
train
DROP TABLE archived_sessions;
[ "PG001" ]
true
Object removal is treated as destructive.
drop_schema
train
DROP SCHEMA old_reporting CASCADE;
[ "PG001" ]
true
Schema deletion is destructive.
required_column_no_default
train
ALTER TABLE orders ADD COLUMN source TEXT NOT NULL;
[ "PG003" ]
false
Existing rows have no supplied value for the new required column.
required_column_with_default
train
ALTER TABLE orders ADD COLUMN source TEXT NOT NULL DEFAULT 'web';
[]
false
A default avoids the PG003 heuristic; not a proof of low lock risk.
type_change
train
ALTER TABLE payments ALTER COLUMN amount TYPE NUMERIC(14,2);
[ "PG004" ]
false
Type rewrite and lock risk should be reviewed.
regular_index
train
CREATE INDEX events_created_idx ON events (created_at);
[ "PG005" ]
false
Ordinary index build receives PG005.
concurrent_index
train
CREATE INDEX CONCURRENTLY events_created_idx ON events (created_at);
[]
false
Concurrent index outside explicit transaction avoids PG005/PG006.
concurrent_index_in_tx
train
BEGIN; CREATE INDEX CONCURRENTLY events_created_idx ON events (created_at); COMMIT;
[ "PG006" ]
true
PostgreSQL disallows concurrent index creation inside a transaction.
add_fk_validated
train
ALTER TABLE orders ADD CONSTRAINT orders_customer_fk FOREIGN KEY (customer_id) REFERENCES customers(id);
[ "PG007" ]
false
Validated FK addition receives a scan/lock warning.
add_fk_not_valid
train
ALTER TABLE orders ADD CONSTRAINT orders_customer_fk FOREIGN KEY (customer_id) REFERENCES customers(id) NOT VALID;
[]
false
NOT VALID FK addition avoids the configured PG007 warning.
add_check_validated
train
ALTER TABLE inventory ADD CONSTRAINT stock_nonnegative CHECK (stock >= 0);
[ "PG007" ]
false
Validated CHECK addition receives PG007.
drop_index
train
DROP INDEX user_email_idx;
[ "PG008" ]
false
Non-concurrent index removal receives PG008.
drop_index_concurrently
train
DROP INDEX CONCURRENTLY user_email_idx;
[]
false
Concurrent index removal avoids the configured PG008 warning.
rename_column
train
ALTER TABLE customers RENAME COLUMN name TO display_name;
[ "PG009" ]
false
Column rename risks old/new application versions during rollout.
set_not_null
train
ALTER TABLE customers ALTER COLUMN email SET NOT NULL;
[ "PG010" ]
false
Immediate NOT NULL validation receives PG010.
syntax_error
train
ALTER TABLE ???
[ "PG000" ]
true
Malformed input should fail parsing under the configured parser.

PostgreSQL Migration Safety Gate Synthetic Fixtures

A compact, hand-authored synthetic fixture set for testing and demonstrating an offline PostgreSQL migration review heuristic. Each row pairs a short SQL migration scenario with the rule IDs and blocking result emitted by the companion educational analyzer.

Dataset structure

Files are JSON Lines: train.jsonl (18 rows), validation.jsonl (5 rows), and test.jsonl (7 rows). Every record contains id, split, sql, expected_rule_ids, blocked, and a short note. The labels are the exact expected outputs of the companion rule set, not ground-truth claims about production safety.

Rules represented: PG000–PG010. The fixtures cover destructive changes, required columns, type changes, index and constraint rollout, renames, syntax errors, and safe additive examples.

Intended use

Use this as a tiny regression/evaluation fixture set for rule-based SQL migration review, label parsing, or classroom demonstrations. The split is fixed for reproducibility; the small size is not suitable for training a general model or estimating real-world performance.

Synthetic scope and limitations

All SQL snippets and notes are synthetic examples written for this dataset; they are not taken from a real company, production database, customer, or incident. expected_rule_ids describe the companion heuristic's behavior. A warning is not proof a migration is unsafe, and an empty label list is not proof it is safe. The analyzer does not connect to PostgreSQL, inspect live schema/data, estimate table size, or guarantee safety. Always review the actual PostgreSQL version, migration runner, deployment sequence, and representative environment.

Companion project

The fixture design follows the public educational analyzer's documented PG000–PG010 checks; this dataset is an independent static fixture collection and does not include production data.

Downloads last month
45