Skip to content

PgOutput2Json.Sqlite 2.2.0 and .NET 11 - #7

Merged
enadzan merged 3 commits into
mainfrom
pgoutput2json-2.2.0
Nov 26, 2026
Merged

enadzan merged 3 commits into
mainfrom
pgoutput2json-2.2.0

Conversation

@enadzan

@enadzan enadzan commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Updates PgOutput2Json.Sqlite from 2.1.1 to 2.2.0, keeping the cache's behavior the same, adds a net11.0 target (EF Core 11), and fixes the worker getting a read-only SQLite connection. PgFreshCache.Lite goes to 2.2.0: a new target framework, with no public API change.

PgOutput2Json.Sqlite 2.2.0

2.2.0 changes the SQLite output in two ways that affect the cache:

  • SubscriptionName is required. Without it UseSqlite throws, and the worker would retry every 10 seconds without ever starting. It is set to the replication slot name: a cache has one source and one slot. An existing file cache's saved position moves to the new key (Position:<slot>) on its first start.
  • Tables of other schemas get new names. By default sales.orders becomes sales_orders. The cache tables are created from the DbContext model, and EF Core's SQLite provider ignores schemas, so the entity's table is orders: the rows would go to a table EF never reads, and the cache would look empty with no error. GetTableName = (schema, table) => table keeps the old names.

A publication with two tables of the same name in different schemas used to mix their rows in one SQLite table without any error. Now PgOutput2Json raises an error naming both tables, and both READMEs say so.

.NET 11

EF Core 11 targets net11.0 only. Without a net11.0 build, a .NET 11 app would run our net10.0 build, compiled against EF Core 10, on EF Core 11. The package now has net8.0/net9.0 (EF Core 9), net10.0 (EF Core 10) and net11.0 (EF Core 11). The test projects target net8.0, net10.0 and net11.0, and CI installs the 11.0.x SDK.

Fix: the worker could get a read-only connection

The cache DbContext makes every connection it opens read-only (PRAGMA query_only) and returns it to the SQLite pool with the setting still on. The worker opened its connections (EnsureCreated, and the one that keeps an in-memory database) with the same connection string. A query of the cache before the worker started, such as a health check or a request at startup, could hand the worker one of those connections. EnsureCreated then failed with "attempt to write a readonly database" on every retry, and the cache never filled. This was already in 2.1.0. On this PR's first CI run it showed up as the permanent-slot integration test failing twice, with the test's own polling query winning the race. The worker's connections are now opened with Pooling=False, as PgOutput2Json already opens its own. ConnectionPoolTests queries the cache before starting the worker, and it failed (file cache) before the fix.

Tests

  • Unit (SqliteOptionsTests): the subscription name is the slot, and tables are named without their schema.
  • Unit (ConnectionPoolTests): the worker creates the tables after the cache was queried, in memory and in a file.
  • Integration: a sales.orders entity is filled by the initial copy and by streamed changes. Without the GetTableName override this test fails (the cache stays empty).
  • Unit and integration tests pass locally on net8.0, net10.0 and net11.0, and the integration tests also pass with TZ=Europe/Zagreb. The Release build passes package validation against 2.1.0.

After 2.2.0 is on nuget.org, it becomes the package validation baseline (AGENTS.md).

🤖 Generated with Claude Code

enadzan and others added 2 commits November 26, 2026 02:29
…he schema

2.2.0 requires SqlitePublisherOptions.SubscriptionName: it is the replication
slot name, a cache having one source and one slot. A saved position of an
existing file cache moves to its new key on the first start.

2.2.0 names a table of another schema than public "schema_table" by default.
The cache tables are created from the DbContext model, and EF Core's SQLite
provider ignores schemas, so the rows of sales.orders must go to "orders":
GetTableName keeps the table name alone, as before. Two published tables with
the same name are now an error of PgOutput2Json instead of mixed rows.

Version 2.1.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHH4BGgzxkjMweveSF9mKD
.NET 11 and EF Core 11 are released, and EF Core 11 targets net11.0 only:
without a net11.0 build, a .NET 11 application ran the net10.0 one, built
against EF Core 10, on the EF Core 11 it uses itself. PgOutput2Json.Sqlite
2.2.0 has a net11.0 build. The tests run on net11.0 too, and CI installs the
.NET 11 SDK.

A new target framework is a minor release: 2.2.0, with PgOutput2Json.Sqlite
2.2.0. The package README has the note on schemas too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHH4BGgzxkjMweveSF9mKD
@enadzan enadzan changed the title PgOutput2Json.Sqlite 2.2.0 PgOutput2Json.Sqlite 2.2.0 and .NET 11 Nov 26, 2026
The cache DbContext makes every connection it opens read-only (PRAGMA
query_only), and returns it to the pool with the setting still on. The
worker opened its connections (EnsureCreated, and the one that keeps an
in-memory database) with the same connection string, so a query of the
cache before the worker started could hand the worker a read-only
connection: EnsureCreated failed with "attempt to write a readonly
database", on every retry, and the cache never filled. A health check or
a request at startup is enough; in CI it was the test polling the cache.

The worker's connections are now opened with Pooling=False (PgOutput2Json
already opens its own that way): they are never one the cache DbContext used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHH4BGgzxkjMweveSF9mKD
@enadzan
enadzan merged commit 4e1da70 into main Nov 26, 2026
4 checks passed
@enadzan
enadzan deleted the pgoutput2json-2.2.0 branch November 26, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant