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

Document differences in CAST(... AS BIGINT) #245

Open
AnyhowStep opened this issue Feb 17, 2020 · 1 comment
Open

Document differences in CAST(... AS BIGINT) #245

AnyhowStep opened this issue Feb 17, 2020 · 1 comment

Comments

@AnyhowStep
Copy link
Owner

SELECT 
  CAST(1.1 AS BIGINT),
  CAST(1.5 AS BIGINT),
  CAST(1.7 AS BIGINT),
  CAST(-1.1 AS BIGINT),
  CAST(-1.5 AS BIGINT),
  CAST(-1.7 AS BIGINT);

PostgreSQL,

int8 int8 int8 int8 int8 int8
1 2 2 -1 -2 -2

SQLite,

CAST(1.1 AS BIGINT) CAST(1.5 AS BIGINT) CAST(1.7 AS BIGINT) CAST(-1.1 AS BIGINT) CAST(-1.5 AS BIGINT) CAST(-1.7 AS BIGINT)
1 1 1 -1 -1 -1

MySQL,

CAST(1.1 AS SIGNED) CAST(1.5 AS SIGNED) CAST(1.7 AS SIGNED) CAST(-1.1 AS SIGNED) CAST(-1.5 AS SIGNED) CAST(-1.7 AS SIGNED)
1 2 2 -1 -2 -2
@AnyhowStep
Copy link
Owner Author

SQLite truncates.

MySQL and PostgreSQL round.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant