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

RangeError: Invalid string length on heroku pg:psql copy with lots of data #1421

Open
JacobEvelyn opened this issue Jan 15, 2020 · 1 comment

Comments

@JacobEvelyn
Copy link

What is the current behavior?

With a small table:

DEBUG=* heroku pg:psql -a my-heroku-app -c "COPY (SELECT * FROM small_table) TO STDOUT;" > ~/Downloads/table.dump
...
  pg Using "DATABASE_URL" to connect to your database… +745ms
--> Connecting to postgresql-whatever-12345
  pg Running query: COPY (SELECT * FROM small_table) TO STDOUT; +2ms

# Completes successfully and data is in ~/Downloads/table.dump

But when there's more data:

DEBUG=* heroku pg:psql -a my-heroku-app -c "COPY (SELECT * FROM very_large_table) TO STDOUT;" > ~/Downloads/table.dump
...
  pg Using "DATABASE_URL" to connect to your database… +701ms
--> Connecting to postgresql-whatever-12345
  pg Running query: COPY (SELECT * FROM very_large_table)  TO STDOUT; +2ms
/Users/jacobevelyn/.local/share/heroku/client/7.35.1/node_modules/@heroku-cli/plugin-pg-v5/lib/psql.js:24
      result += data.toString()
                     ^

RangeError: Invalid string length
    at Socket.<anonymous> (/Users/jacobevelyn/.local/share/heroku/client/7.35.1/node_modules/@heroku-cli/plugin-pg-v5/lib/psql.js:24:22)
    at Socket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:308:12)
    at readableAddChunk (_stream_readable.js:289:11)
    at Socket.Readable.push (_stream_readable.js:223:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:182:23)

What is the expected behavior?

The second example above should complete successfully, like the first.

This is happening on Heroku CLI version heroku/7.35.1 darwin-x64 node-v12.13.0 on macOS 10.15.2. I'm not behind an HTTP proxy or firewall.

@kferch-teamworks
Copy link

+1

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

No branches or pull requests

2 participants