Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to refresh a materialised view throws error #63

Open
samwillis opened this issue Mar 28, 2024 · 0 comments
Open

Attempting to refresh a materialised view throws error #63

samwillis opened this issue Mar 28, 2024 · 0 comments

Comments

@samwillis
Copy link
Collaborator

Attempting to refresh a materialised view throws error:

Uncaught error: expected one dependency record for TOAST table, found 4

Reproduction:

import { PGlite } from "../dist/index.js";

console.log("Starting...");
const pg = new PGlite();

// Test materialized view
await pg.exec(`
  CREATE TABLE IF NOT EXISTS test (
    id SERIAL PRIMARY KEY,
    name TEXT
  );
`);
await pg.exec(`
  INSERT INTO test (name) VALUES ('test');
`);
await pg.exec(`
  CREATE MATERIALIZED VIEW test_view AS
  SELECT * FROM test;
`);
const res = await pg.exec(`
  SELECT * FROM test_view;
`);
console.log(res);
await pg.exec(`
  INSERT INTO test (name) VALUES ('test2');
`);
const res2 = await pg.exec(`
  SELECT * FROM test_view;
`);
console.log(res2);
await pg.exec(`
  REFRESH MATERIALIZED VIEW test_view;
`);
const res3 = await pg.exec(`
  SELECT * FROM test_view;
`);
console.log(res3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant