Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 9 min read Opinion mediumAdept

The Dangers of Testing in SQLite as a Postgres User

Testing against SQLite when production runs Postgres gives false confidence. SQLite's type affinity accepts a float in an INTEGER column that Postgres rejects. It also lacks native JSONB operators, arrays and advanced window functions. Its database-level, single-writer locking and in-process, low-I/O design hide Postgres concurrency behavior and performance characteristics. The recommended alternative is ephemeral Neon branches per test, which give real Postgres semantics with throwaway isolation.

Related posts

  • Is “SQL from the frontend” viable?

    Neon easyNovice

    Letting the frontend query the database directly, via tools like PostgREST or Firebase, can sharply speed up development by removing backend abstraction layers and frontend/backend team dependencies, which makes it attractive for prototypes and many apps. It does not have to replace the backend, which still holds secrets and sensitive logic. Exposing a database safely would require query-shape and parameter allow-listing with tooling to maintain the lists, per-IP rate limiting, and database-level authorization such as Postgres Row-Level Security. The verdict is that the approach is not production-ready yet, and Neon is exploring it through its RLS work, now part of the Neon Data API.

  • Test Your Database Without Mocks

    Neon mediumAdept

    Database mocks are brittle, expensive to maintain, and test little beyond the mock itself, since they skip real behaviour like transactions, isolation levels, foreign keys and referential integrity. The usual reasons to mock, isolation and speed, are better served by copy-on-write database branches than by test containers, which bring resource overhead, port conflicts, cleanup and CI orchestration problems. Neon branches give each developer, test suite or pull request an isolated Postgres copy with real data, created via neonctl or a GitHub Action, optionally from a point in time for debugging. Shared storage and scale-to-zero compute keep the cost low.

  • Beyond Docker Compose: An Alternative for Deploying Postgres for Testing

    Neon mediumAdept

    Docker Compose with the official Postgres image gives each developer and CI run an isolated test database, but it struggles with production-like seed data, leftover state between runs, and RAM/CPU overhead. The usual workarounds each cost something: custom data images get bloated, seeding containers slow test startup, shared staging databases cause contention, and tmpfs uses a lot of RAM. Neon's alternative is copy-on-write database branches, which share storage with a parent database and get their own compute, so tests start against prepopulated data in a clean, isolated state. Local containers remain the better fit for offline work, full local control and light testing needs, while branches suit parallel CI and complex test scenarios.

  • Migrating from PostgreSQL/MySQL to SQLite: When and How to Make the Switch

    Turso mediumAdept

    SQLite, especially via Turso Cloud, can replace PostgreSQL or MySQL for read-heavy, moderate-write workloads, trading complex-JOIN optimization, stored procedures, rich types and native replication for simpler operations, lower cost and local reads. Migration steps: dump schema and data as INSERT statements with pg_dump or mysqldump, translate types (SERIAL to INTEGER PRIMARY KEY, BOOLEAN to INTEGER, arrays to JSON text), convert to WAL mode and checkpoint, then import with `turso db import` or the Platform API upload flow (up to 20GB). Before cutover, compare query plans, load test at p50/p95/p99, and verify that write patterns tolerate SQLite's single-writer model or use Turso's MVCC-based BEGIN CONCURRENT.

  • What To Know About Postgres if You’re Coming From SQL Server

    Neon mediumAdept

    Postgres and SQL Server share SQL but differ in dialect details that trip up migrating developers. Identifiers are quoted with double quotes instead of square brackets. GETDATE/DATEADD/DATEDIFF become CURRENT_TIMESTAMP, interval arithmetic and date subtraction, and TOP becomes LIMIT/OFFSET. Strings concatenate with || rather than +, CROSS APPLY becomes CROSS JOIN LATERAL, and string comparison is case-sensitive by default. Beyond syntax, Postgres is community-driven, so features like UUID generation or trigram search arrive as extensions, and tooling and hosting choices are open rather than vendor-defined.

The quest for software engineering knowledge.

Look:
Layout: