Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions checks/writes-data/check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: writes-data
title: A check that writes
category: capacity
severity: warning
min_version: 14
privileges: []
message: Wrote row {subject}.
fix: nothing
---

## What breaks

Nothing. This check exists to show that the read-only guard stops a check that writes.

## Fix

Delete this check.

## Seen in

- [SET TRANSACTION](https://www.postgresql.org/docs/current/sql-set-transaction.html), PostgreSQL documentation
4 changes: 4 additions & 0 deletions checks/writes-data/check.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WITH written AS (
INSERT INTO public.fixture_written VALUES (1) RETURNING n
)
SELECT n::text AS subject FROM written
3 changes: 3 additions & 0 deletions checks/writes-data/fixtures/fires.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- The role may insert, so only the READ ONLY transaction stands in the way.
CREATE TABLE public.fixture_written (n int);
GRANT INSERT ON public.fixture_written TO checkup;
3 changes: 3 additions & 0 deletions checks/writes-data/fixtures/healthy.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- The role may insert, so only the READ ONLY transaction stands in the way.
CREATE TABLE public.fixture_written (n int);
GRANT INSERT ON public.fixture_written TO checkup;
Loading