ozum / pg-structure

Get PostgreSQL database structure as a detailed JS Object.
http://www.pg-structure.com
MIT License
353 stars 27 forks source link

error: '3752' cannot be found in NormalFunction's oid #94

Open madflow opened 1 month ago

madflow commented 1 month ago

This is a drive-by bug report. I am just toying around with this library. No expectations.

import pgStructure from "pg-structure";

const db = await pgStructure(
  {
    database: "postgres",
    user: "postgres",
    password: "postgres",
  },
  {
    includeSchemas: ["public"],
  },
);
486 |     get(value, { key = this.defaultKey, fromIndex = 0, throwUnknown = this._throwUnknown, } = {}) {
487 |         const index = this.getIndex(value, { key, fromIndex });
488 |         if (throwUnknown && index === -1) {
489 |             const firstObjectElement = this.find((e) => typeof e === "object");
490 |             const possibleType = firstObjectElement && `${firstObjectElement.constructor.name}'s `;
491 |             throw new Error(`'${value}' cannot be found in ${possibleType || ""}${key}.`);
                        ^
error: '3752' cannot be found in NormalFunction's oid.
      at get (/pg-structure/node_modules/indexable-array/dist/index.js:491:19)
      at /pg-structure/node_modules/pg-structure/dist/main.js:237:22
      at forEach (:1:21)
      at addTriggers (/pg-structure/node_modules/pg-structure/dist/main.js:235:5)
      at addObjects (/pg-structure/dist/main.js:339:5)
      at /pg-structure/node_modules/pg-structure/dist/main.js:378:5

Bun v1.1.10 (macOS arm64)
ozum commented 1 month ago

Thank you @madflow for the report. I will examine the problem.