Skip to content

Docs: error in the async/await Pooling example? #1410

Closed
@mariuslundgard

Description

@mariuslundgard

I had issues with running out of connections when starting out from the async/await example in the docs.

// async/await - check out a client
(async () => {
  const client = await pool.connect()
  try {
    const res = await pool.query('SELECT * FROM users WHERE id = $1', [1])
    console.log(res.rows[0])
  } finally {
    client.release()
  }
})().catch(e => console.log(e.stack))

Should pool.query actually be client.query here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions