Skip to content

Commit

Permalink
Merge pull request #3820 from cockroachdb/string-aliases
Browse files Browse the repository at this point in the history
String aliases are preserved
  • Loading branch information
lhirata committed Oct 6, 2018
2 parents cd203cd + 81e7729 commit 506ec1f
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions v2.1/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,11 @@ The size of a `STRING` value is variable, but it's recommended to keep values un
~~~

~~~
+-------------+-----------+-------------+----------------+-----------------------+-------------+
| column_name | data_type | is_nullable | column_default | generation_expression | indices |
+-------------+-----------+-------------+----------------+-----------------------+-------------+
| a | STRING | false | NULL | | {"primary"} |
| b | STRING(4) | true | NULL | | {} |
| c | STRING | true | NULL | | {} |
+-------------+-----------+-------------+----------------+-----------------------+-------------+
column_name | data_type | is_nullable | column_default | generation_expression | indices | is_hidden
+-------------+-----------+-------------+----------------+-----------------------+-------------+-----------+
a | STRING | false | NULL | | {"primary"} | false
b | STRING(4) | true | NULL | | {} | false
c | STRING | true | NULL | | {} | false
(3 rows)
~~~

Expand All @@ -89,11 +87,29 @@ The size of a `STRING` value is variable, but it's recommended to keep values un
~~~

~~~
a | b | c
+----------+------+--------+
| a | b | c |
+----------+------+--------+
| a1b2c3d4 | e5f6 | g7h8i9 |
+----------+------+--------+
a1b2c3d4 | e5f6 | g7h8i9
(1 row)
~~~

{% include copy-clipboard.html %}
~~~ sql
> CREATE TABLE aliases (a STRING PRIMARY KEY, b VARCHAR, c CHAR);
~~~

{% include copy-clipboard.html %}
~~~ sql
> SHOW COLUMNS FROM aliases;
~~~

~~~
column_name | data_type | is_nullable | column_default | generation_expression | indices | is_hidden
+-------------+-----------+-------------+----------------+-----------------------+-------------+-----------+
a | STRING | false | NULL | | {"primary"} | false
b | VARCHAR | true | NULL | | {} | false
c | CHAR | true | NULL | | {} | false
(3 rows)
~~~

## Supported casting and conversion
Expand Down

0 comments on commit 506ec1f

Please sign in to comment.