-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: INT4 column type not reported as INT4 when inspecting column types (SHOW CREATE, errors etc) #25098
Copy link
Copy link
Closed
Labels
A-sql-semanticsC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityS-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.
Description
According to https://www.cockroachlabs.com/docs/stable/int.html#names-and-aliases, INT4 is treated as a 32-bit type that can't simply be aliased to a full 64-bit INTEGER. However, the actual code does convert INT4 columns to INTEGER on both v1.1.4 and v2.0.1:
root@:26257/> create database foo; CREATE DATABASE
Time: 5.524673ms
root@:26257/> create table foo.bar (x INT4, y INT, z INT2);
CREATE TABLE
Time: 5.551593ms
root@:26257/> show create table foo.bar;
+---------+---------------------------------------+
| Table | CreateTable |
+---------+---------------------------------------+
| foo.bar | CREATE TABLE bar ( |
| | |
| | x INTEGER NULL, |
| | |
| | y INT NULL, |
| | |
| | z SMALLINT NULL, |
| | |
| | FAMILY "primary" (x, y, z, rowid) |
| | |
| | ) |
+---------+---------------------------------------+
(1 row)
Time: 7.215492msWhich is wrong -- the code or the docs?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-semanticsC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityS-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.