[CockroachDB] No difference between `integer` and `bigInteger`
See original GitHub issueEnvironment
Knex version: 0.95.15+ Database + version: CockroachDB v21.1.13 OS: macOS Monterrey
Bug
Both integer
and bigInteger
both result in a int8
column being created in CockroachDB, whereas Postgres creates them as int4
and int8
respectively. This becomes an issue, as int8
s are always returned as a String by the pg
connection library, causing unexpected incompatibilities between the database vendors.
knex.schema.createTable('example', (table) => {
table.increments();
table.integer('example_int');
table.bigInteger('example_bigint');
});
Note how both columns are created as an int8
in CockroachDB.
I believe this is due to the fact that CockroachDB defaults to int8
when using .. ADD COLUMN example INTEGER
, which is the default from here (AFAICT as the PG dialect doesn’t have a specific integer
in the columncompiler).
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:17 (1 by maintainers)
Top Results From Across the Web
INT | CockroachDB Docs
The different integer types place different constraints on the range of allowable values, but all integers are stored in the same way regardless...
Read more >INT vs BIGINT - ObjectRocket
INT and BIGINT are both integer numeric data types. Let us compare both of them in terms of storage size, minimum value, maximum...
Read more >CockroachDB - creating limited key ranges
... you're migrating an application to CockroachDB from a different database where the old database schema was using int-based keys, it is ...
Read more >CockroachDB Data Types Cheatsheet - TablePlus
ARRAY, A 1-dimensional, 1-indexed, homogenous array of any non-array data type. ... INT, 64-bit, INTEGER, INT8, INT64, BIGINT.
Read more >Using Prisma with CockroachDB
use Introspection for existing projects if you already have a CockroachDB database; use Prisma Migrate to migrate your database schema to a new...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nickrum I like that idea, but I wonder how intrusive that would be. Maybe it would be easier to achieve not as an option, but as a separate dialect, extending vanilla cockroachdb one. I would still like to hear @rafiss perspective first, because maybe we would be sabotaging crdb by overriding defaults that might be there for a good reason.
As of right now, it means that (for CRDB):
integer
/bigInteger
andincrements
/bigIncrements
.increments
doesn’t actually use auto-incrementing integers, like the name suggests