Postgres playground: run SQL in your browser.

Try PostgreSQL queries and row level security with PGlite, a WebAssembly database that stays on your device — free, no sign-up.

Loading the tool…

PostgreSQL in a local in-memory worker. No remote database, no persistence. auth.uid() is a teaching simulation, not an authentication implementation.

How to use

  1. Choose Load SQL engine. The page shows the engine download size before it loads.
  2. Pick an example or write SQL. RLS examples switch to a non-owner role and simulate auth.uid() with a setting.
  3. Choose Run SQL, inspect each result table and export JSON. Reset database / stop discards all local data.

Reference documentation

Frequently asked questions

Is this free, and is SQL sent to a server?

Free, no sign-up. Static JavaScript, WASM and database engine files are downloaded when you load PGlite. Your SQL and results execute inside a browser worker and are never sent to a processing server. Usage analytics include only the tool name and action.

Is this a real PostgreSQL engine?

PGlite is PostgreSQL compiled to WebAssembly. It supports SQL and row level security locally. It is not a connection to a hosted database, and it does not include the Supabase Auth, Storage or Realtime services. PGlite overview ↗

How much does the engine weigh?

The tool displays measured uncompressed and gzip sizes for the pinned JavaScript, WASM and database bundle. The engine is loaded only on demand, runs in a separate worker and is not included in the initial page scripts. Transfer size depends on the host compression and browser cache.

How is auth.uid() simulated?

A local auth.uid() function reads request.jwt.claim.sub with current_setting and converts it to UUID. The examples use set_config and a non-owner role without BYPASSRLS. This demonstrates policy behavior; a visitor-editable setting is not secure authentication.

Why must the RLS examples change roles?

Table owners and roles with BYPASSRLS usually bypass policies. The samples grant SELECT to playground_user, a separate non-owner role, then SET ROLE before querying. Alice sees her rows, Bob sees his, and a blank identity sees none.

Do my tables persist after closing the page?

No. The database is in memory and lasts only while its worker is running. Reset, reload or leaving the page discards it. Export results before you leave. A worker that runs too long is terminated; reload the engine for a fresh database.

Related tools

All free tools

Read this page as Markdown