pglite
pglite copied to clipboard
Missing "pg_catalog.pg_tables" and "information_schema.tables"
I tried running this SQL query:
select * from pg_catalog.pg_tables
But I got this error:
RuntimeError: relation "pg_catalog.pg_tables" does not exist at character 15
Is there a way to do this at the moment? If not, could there be?
Interesting - most of the catalog tables are there, but not this one (src )
Could be due to the way the underlying fork handles the storage?
Full list of catalog
Huh, yeah - this works for me
select * from pg_catalog.pg_type
This query works for me to list tables:
select relname from pg_class
join pg_namespace on pg_namespace.oid = pg_class.relnamespace
where pg_class.relkind = 'r'
and relname not like 'pg_%'
I've been playing around with this in an Observable Framework notebook here: https://simonw.github.io/observable-framework-experiments/postgresql
Source code here: https://github.com/simonw/observable-framework-experiments/blob/main/docs/postgresql.md?plain=1
I believe this is due to the simplified initdb.ts that replaces the conventional initdb command that comes with Postgres. It's not fully creating all the catalog tables.
We should look at compiling initdb to wasm, although it runs postgres --boot which we would need to do separately which creates a little complexity.
fyi also seeing this with await new PGlite("./pgdata").query('select * from pg_catalog.pg_roles');
Would be really awesome if pglite could work with postgraphile. I have a PoC repo I can share for testing if you're interested.
The missing "pg_catalog.pg_tables" and "information_schema.tables" (among others) are fixed in #41 and we plan to do a release early next week after a few finals checks.
If anyone wants to take it for a spin, there is dev build linked in PR #48 which is the tip of a stack of PRs.