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

PostgreSQL Compatibility: add note about INTEGER type width #13418

Open
michae2 opened this issue Mar 29, 2022 · 2 comments
Open

PostgreSQL Compatibility: add note about INTEGER type width #13418

michae2 opened this issue Mar 29, 2022 · 2 comments
Labels
C-doc-improvement pg-compat Change implemented for PostgreSQL compatibility

Comments

@michae2
Copy link

michae2 commented Mar 29, 2022

Michael Erickson (michae2) commented:

In PostgreSQL the INTEGER type (or INT type) is 4 bytes wide, and has a min and max of -2147483648 and +2147483647, respectively. In CockroachDB the INTEGER / INT type is 8 bytes wide, and has a min and max of -9223372036854775807 and +9223372036854775807, respectively.

The ranges of the integer types are already covered in int.html but I think it would help to also spell out this difference from PostgreSQL in postgresql-compatibility.html#features-that-differ-from-postgresql.

Demonstration, on PostgreSQL 14.2:

michae2=# SELECT 2147483648::INT;
2022-03-29 15:42:54.876 PDT [57108] ERROR:  integer out of range
2022-03-29 15:42:54.876 PDT [57108] STATEMENT:  SELECT 2147483648::INT;
ERROR:  integer out of range

And CockroachDB 22.1:

[email protected]:26257/defaultdb> SELECT 2147483648::INT;
     int8
--------------
  2147483648
(1 row)


Time: 1ms total (execution 0ms / network 0ms)

Jira Issue: DOC-3069

Jira Issue: DOC-4430

@michae2
Copy link
Author

michae2 commented Apr 1, 2022

I see, this is discussed more in int.html#considerations-for-64-bit-signed-integers. Maybe there could be a link from postgresql-compatibility.html#features-that-differ-from-postgresql?

Feel free to close this if invalid.

@michae2
Copy link
Author

michae2 commented Apr 1, 2022

I guess this ultimately depends on cockroachdb/cockroach#26925

@michae2 michae2 added the pg-compat Change implemented for PostgreSQL compatibility label Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-doc-improvement pg-compat Change implemented for PostgreSQL compatibility
Projects
None yet
Development

No branches or pull requests

1 participant