Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Postgresql error: query.on is not a function #1041

Closed
pushkarnagle opened this issue Aug 25, 2017 · 8 comments
Closed

Postgresql error: query.on is not a function #1041

pushkarnagle opened this issue Aug 25, 2017 · 8 comments

Comments

@pushkarnagle
Copy link

I am trying to use Postgresql as DB adapter. I have installed latest version, created new user and database and have granted all privileges to the new user.
But while running Gekko, I am getting below error:

2017-08-25 13:34:22 (DEBUG):	Check database exists: gekko
/root/gekko/plugins/postgresql/handle.js:47
  query.on('row', function(row) {
        ^

TypeError: query.on is not a function
    at /root/gekko/plugins/postgresql/handle.js:47:9
    at Connection.<anonymous> (/root/gekko/node_modules/pg/lib/client.js:153:7)
    at Connection.g (events.js:292:16)
    at emitOne (events.js:101:20)
    at Connection.emit (events.js:188:7)
    at Socket.<anonymous> (/root/gekko/node_modules/pg/lib/connection.js:118:12)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)

@pushkarnagle
Copy link
Author

I installed old version of pg by npm install pg@6.4.0 and the issue is solved!

@askmike
Copy link
Owner

askmike commented Aug 25, 2017

great :)

@davidlondono
Copy link
Contributor

Add it to the Dockerfile, is causing issues

@pushkarnagle
Copy link
Author

pushkarnagle commented Aug 31, 2017

Well, installing an old version gave rise to another problem. I am now using version 6.4.0 of pg, but getting below error -

events.js:160
      throw er; // Unhandled 'error' event
      ^

error: syntax error at or near "ON"
    at Connection.parseE (/home/pi/gekko/node_modules/pg/lib/connection.js:567:11)
    at Connection.parseMessage (/home/pi/gekko/node_modules/pg/lib/connection.js:391:17)
    at Socket.<anonymous> (/home/pi/gekko/node_modules/pg/lib/connection.js:129:22)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:547:20)

EDIT: This might be helpful https://node-postgres.com/guides/upgrading
There are some changes in pg@7.0.0 onwards.

@pushkarnagle pushkarnagle reopened this Aug 31, 2017
@pushkarnagle
Copy link
Author

@askmike Can you please fix this? query.on is not supported in pg 7.2.0

@siedi
Copy link

siedi commented Sep 3, 2017

I replaced pg with pg@6 in the Dockerfile and it worked like a charm. (though the library throws some deprecated warnings now)

@askmike
Copy link
Owner

askmike commented Sep 3, 2017

@siedi would you mind submitting a PR? Thanks!

nourspace added a commit to nourspace/gekko that referenced this issue Oct 25, 2017
askmike pushed a commit that referenced this issue Dec 4, 2017
* Fix node-postgres version to 6.1.0 on Dockerfile

Refs #1041

* Fixed spelling of names
askmike pushed a commit that referenced this issue Dec 5, 2017
* Fix node-postgres version to 6.1.0 on Dockerfile

Refs #1041

* Fix sharpe ratio formula
askmike pushed a commit that referenced this issue Dec 7, 2017
* Fix node-postgres version to 6.1.0 on Dockerfile

Refs #1041

* docs: fixed spelling error in introduction

"build in" to "built-in"
@stale
Copy link

stale bot commented Oct 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me.

@stale stale bot added the wontfix label Oct 24, 2018
@stale stale bot closed this as completed Oct 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants