Skip to content

Confusion – cursor.read(...) Query(cursor).read(...) #51

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

Closed
wants to merge 1 commit into from

Conversation

jglodek
Copy link

@jglodek jglodek commented Nov 27, 2019

I think this might have changed somewhere along the road.

I definitely get when I do query(cursor).read(...),

(node:17795) UnhandledPromiseRejectionWarning: TypeError: cursor.read is not a function
    at postgres.connect.then (/root/scraper/interpret_scaped_data.js:69:10)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

And

query(cursor).then((cursor) => {cursor.read(...)}) doesn't work the promise never gets there.

I think this might have changed somewhere along the road.
@netlify
Copy link

netlify bot commented Nov 27, 2019

Hey! A preview of the changes is deployed on netlify to take a look at! :)

Built with commit a82affb

https://deploy-preview-51--hopeful-clarke-f36d36.netlify.com

@brianc
Copy link
Owner

brianc commented Nov 27, 2019

Good catch - sorry about that! That's actually kinda weird that it returns a promise when you pass a cursor in.

https://github.com/brianc/node-postgres/blob/master/lib/client.js#L466

What version of pg & pg-cursor are you using, out of curiosity?

Copy link
Collaborator

@charmander charmander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn’t how it’s supposed to work. Are you sure you’re using client.query() and not pool.query()?

@charmander charmander closed this Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants