cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.86k stars 3.77k forks source link

Support variable substitution in sql scripts #33725

Open chriswhite199 opened 5 years ago

chriswhite199 commented 5 years ago

Add variable substitution to cockroach sql cli, similar to psql -v option:

echo "CREATE DATABASE IF NOT EXISTS :dbname" | cockroach sql -v dbname=test

Origin: https://forum.cockroachlabs.com/t/execute-cockroach-sql-with-variable-substitution/2310

In the meantime, as pointed out on the above forum post, you can use psql to enable this.

Jira issue: CRDB-6348

knz commented 5 years ago

thanks for filing!

tim-o commented 5 years ago

Zendesk ticket #3090 has been linked to this issue.

github-actions[bot] commented 4 months ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!