CARVIEW |
Select Language
HTTP/2 200
date: Tue, 14 Oct 2025 05:30:29 GMT
server: Fly/5d9a8537e (2025-10-13)
content-type: text/html; charset=utf-8
content-encoding: gzip
via: 2 fly.io, 2 fly.io
fly-request-id: 01K7GK5NP43ZY23ARTCQPB07QM-bom
Show the SQL schema for a PostgreSQL database | Simon Willison’s TILs
Show the SQL schema for a PostgreSQL database
This took me longer to figure out than I care to admit.
pg_dump -s name-of-database
Surprisingly there doesn't seem to be an easy way to do this using a SELECT
statement within PostgreSQL itself.
StackOverflow offers up a terrifying 72 line SQL monstrosity that attempts to recreate the CREATE TABLE
for a given table.
Related
- sqlite List all columns in a SQLite database - 2020-05-06
- fly Configuring Django SQL Dashboard for Fly PostgreSQL - 2023-08-21
- postgresql Upgrade Postgres.app on macOS - 2024-06-15
- gis Using SQL with GDAL - 2023-03-09
- datasette Searching all columns of a table in Datasette - 2021-08-23
- postgresql Granting a PostgreSQL user read-only access to some tables - 2021-02-26
- heroku Using heroku pg:pull to restore a backup to a macOS laptop - 2020-07-10
- github-actions Installing different PostgreSQL server versions in GitHub Actions - 2021-07-05
- bash Escaping a SQL query to use with curl and Datasette - 2020-12-08
- sqlite SQLite timestamps with floating point seconds - 2024-03-13
Created 2021-02-23T19:03:04-08:00 · Edit