Skip to content

Inheriting pg.Pool will overwrite any custom methods. #1505

Open
@ghost

Description

If you were to create a class that inherits pg.Pool like so:

const pg = require('pg');

class Db extends pg.Pool {
  insert(args) {
    return this.query('...');
  }
}

const a = new Db();

console.log(a.insert); // undefined

The method insert() would be undefined on all instances of this custom class. If you were to do the exact same thing with pg.Client, it works as expected.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions