Answer the question
In order to leave comments, you need to log in
How to dump postgresql via nodejs?
Colleagues, good day. Tell me who means what is wrong. The task is to dump postgresql from NodeJS.
Team:
pg_dump postgres://<user>:<password>@localhost:5432/<dbName> > /home/projects/<projectName>/_dbDumps/20220418.sql
exec(`pg_dump postgres://<user>:<password>@localhost:5432/<dbName> > /home/projects/<projectName>/_dbDumps/20220418.sql`, (error, stdout, stderr) => {
if (error) {
console.log(`error: ${ error.message }`);
return;
}
if (stderr) {
console.log(`stderr: ${ stderr }`);
return;
}
console.log(`stdout: ${ stdout }`);
resolve();
});
error: Command failed: pg_dump postgres://<user>:<password>@localhost:5432/<dbName> > /home/projects/<projectName>/_dbDumps/20220418.sql
pg_dump: error: query failed: ERROR: cache lookup failed for index 0
pg_dump: error: query was: SELECT t.tableoid, t.oid, t.relname AS indexname, inh.inhparent AS parentidx, pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, i.indnkeyatts AS indnkeyatts, i.indnatts AS indnatts, i.indkey, i.indisclustered, i.indisreplident, c.contype, c.conname, c.condeferrable, c.condeferred, c.tableoid AS contableoid, c.oid AS conoid, pg_catalog.pg_get_constraintdef(c.oid, false) AS condef, (SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) AS tablespace, t.reloptions AS indreloptions, (SELECT pg_catalog.array_agg(attnum ORDER BY attnum) FROM pg_catalog.pg_attribute WHERE attrelid = i.indexrelid AND attstattarget >= 0) AS indstatcols,(SELECT pg_catalog.array_agg(attstattarget ORDER BY attnum) FROM pg_catalog.pg_attribute WHERE attrelid = i.indexrelid AND attstattarget >= 0) AS indstatvals FROM pg_catalog.pg_index i JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) JOIN pg_catalog.pg_class t2 ON (t2.oid = i.indrelid) LEFT JOIN pg_catalog.pg_constraint c ON (i.indrelid = c.conrelid AND i.indexrelid = c.conindid AND c.contype IN ('p','u','x')) LEFT JOIN pg_catalog.pg_inherits inh ON (inh.inhrelid = indexrelid) WHERE i.indrelid = '210191'::pg_catalog.oid AND (i.indisvalid OR t2.relkind = 'p') AND i.indisready ORDER BY indexname
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question