sqlstreak

PostgreSQL playground: run Postgres online

A real PostgreSQL engine (PGlite) running in your browser tab, with sample databases loaded. Write a query, press Run, and see the result. Below: what this PostgreSQL can and can't do, and five queries that only work in PostgreSQL.

PostgreSQL 18.6 (PGlite 0.5.16), read from the engine itself when this page was built.

Each run starts from a fresh copy of the sample data. To try your own tables, put CREATE TABLE, INSERT and your SELECT in one run.

What works here

  • ✓CTEs, including WITH RECURSIVE
  • ✓Window functions with frames (ROWS BETWEEN …)
  • ✓generate_series for numbers and dates
  • ✓DISTINCT ON, FILTER (WHERE …) and ILIKE
  • ✓Date functions: date_trunc, EXTRACT, to_char, intervals
  • ✓JSON functions and operators (json_build_object, ->>)
  • ✓Arrays and array_agg
  • ✓CREATE TABLE, INSERT, UPDATE, DELETE and ON CONFLICT upserts

What doesn't

  • –No extensions are loaded (no PostGIS or pgvector)
  • –One connection: no concurrent sessions, locks or LISTEN/NOTIFY
  • –No server settings, users or roles
  • –Every run starts from a fresh copy of the data and is rolled back afterwards

Five queries only PostgreSQL runs

Each one was run on both engines when this page was built: it works in PostgreSQL and fails in SQLite. More side by side in PostgreSQL vs SQLite.

PostgreSQL questions

Is this a real PostgreSQL?+

Yes. It's PGlite: the PostgreSQL source compiled to WebAssembly, running in your browser tab. Syntax, functions, types and error messages are PostgreSQL's own. The version is printed above.

Can I create my own tables?+

Yes. Put CREATE TABLE, INSERT and your SELECT in one run. Each run happens inside a transaction that is rolled back afterwards, so the next run starts from the sample data again.

Can I install extensions like PostGIS?+

No. The playground loads no extensions, so CREATE EXTENSION fails. Everything built into PostgreSQL itself works: JSON, arrays, window functions, recursive CTEs, generate_series.

Can I use BEGIN, COMMIT or SET?+

Transaction commands are blocked because every run is already wrapped in its own transaction. There's one connection and no server to configure, so settings, roles and LISTEN/NOTIFY don't apply.

Does PostgreSQL support RETURNING and upserts here?+

Yes. INSERT … ON CONFLICT … DO UPDATE and RETURNING work as on a server, which makes this a good place to try them without touching real data.

SQL guides

Joins, window functions, CTEs and more, with runnable examples.

SQL errors explained

What common PostgreSQL and SQLite errors mean and how to fix them.

Learn SQL daily

Five-minute lessons with instant feedback and a streak. Free to start.