Коллеги, доброго времени суток. Подскажите кто значет что не так. Задача нужно сделать дамп postgresql из NodeJS.
Команда:
pg_dump postgres://<user>:<password>@localhost:5432/<dbName> > /home/projects/<projectName>/_dbDumps/20220418.sql
Запускаю из терминала, все ок. Запускаю из NodeJS:
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
параметры user password и другие подставляются норм. в чем проблема?
Заранее спасибо.