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

The connection string isn't parsed correctly in Windows PowerShell #3

Closed
ianjevans opened this issue Aug 23, 2021 · 3 comments · Fixed by #4
Closed

The connection string isn't parsed correctly in Windows PowerShell #3

ianjevans opened this issue Aug 23, 2021 · 3 comments · Fixed by #4

Comments

@ianjevans
Copy link
Contributor

From Richard C. on Slack:

the connection string isn't parsed correctly in windows

const command = `cockroach sql --url '${connectionString}' < dbinit.sql`;

If you copy in a windows path for your input from the prompt, the slashes don't parse correctly.
Also most windows users I encountered use powershell and theres no redirection operator.

This caused problems during a Hackathon event.

I think we could replace the redirect with --file dbinit.sql.

@ericharmeling
Copy link
Contributor

Thanks for filing this.

Does --file dbinit.sql resolve the issue on Windows?

One drawback to using --file/-f is that these flags are not supported in CRDB versions < 21.1. (I don't believe cockroachdb/cockroach#54741 was backported).

@ianjevans
Copy link
Contributor Author

There are two separate issues keeping this from working on Windows:

  1. The slashes in the connection string aren't parsed correctly on Windows.
  2. The cockroachdb sql command doesn't work with Unix-style redirection on Windows.

One drawback to using --file/-f is that these flags are not supported in CRDB versions < 21.1. (I don't believe cockroachdb/cockroach#54741 was backported).

The CC console gives instructions on downloading v21.1 binaries for Windows:
Screen Shot 2021-08-23 at 9 18 53 AM

So presumably Windows users would be able to connect to < v21.1 clusters if they are using v21.1+ binaries, yeah?

@ericharmeling
Copy link
Contributor

I'm just going to remove the command const and have users run the cockroach command themselves. That should resolve both of these issues.

The remaining problem is that the environment variable is not $HOME in Windows connection strings. (As you pointed out here: cockroachlabs/hello-world-node-postgres#1). I can resolve that by just adding an extra condition on the connection string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants