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

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

Open
madflow opened this issue Jun 3, 2024 · 3 comments
Open

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

madflow opened this issue Jun 3, 2024 · 3 comments
Labels

Comments

@madflow
Copy link

madflow commented Jun 3, 2024

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
Copy link
Owner

ozum commented Jun 4, 2024

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

@ozum ozum added the bug label Jun 4, 2024
@blimmer
Copy link

blimmer commented Sep 4, 2024

I also encountered this today:

Screenshot_2024-09-04_at_15_35_52

Interestingly, it only happens when I pass includeSchemas: ['public'].

@blimmer
Copy link

blimmer commented Sep 4, 2024

Ah, @stephenh gave me a heads up - the issue is that a trigger is referencing a schema I didn't include in the includeSchemas array. That's also why it works when I don't specify includeSchemas.

Looks like this is a related issue: #85

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants