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

sql: int4 support #12481

Closed
kerneldump opened this issue Dec 19, 2016 · 6 comments
Closed

sql: int4 support #12481

kerneldump opened this issue Dec 19, 2016 · 6 comments
Assignees
Milestone

Comments

@kerneldump
Copy link

Current build information:
Build Tag: beta-20161215
Build Time: 2016/12/15 15:10:48
Platform: linux amd64
Go Version: go1.7.3
C Compiler: gcc 4.9.2

Hello, I’m trying to replace MySQL/PostgreSQL with CockroachDB for RunDeck (http://rundeck.org/). Having issues with “int4” and “create sequence”. Would it be possible to add an alias for int4 (similar to what you have for int8) and “create_sequence” support. Here are my logs when trying to start rundeck daemon => http://pastebin.com/yMqJGEUd

Relevant lines:
2016-12-17 09:08:14,570 [main] ERROR hbm2ddl.SchemaUpdate - ERROR: syntax error at or near "int4"
2016-12-17 09:08:14,952 [main] ERROR hbm2ddl.SchemaUpdate - HHH000388: Unsuccessful: create sequence hibernate_sequence

@bdarnell
Copy link
Contributor

CREATE SEQUENCE is tracked in #5811.

We support int8 but not other sized integer types because our integers are in fact 8 bytes. So it would be slightly misleading for us to implement int4 backed by a 64-bit integer, but maybe it's worthwhile for the compatibility (it seems likely that most users specify the minimum size they need and don't care too much if the actual type has more range than specified). I suppose we could even turn the smaller integer types into integers with a CHECK constraint that their values are in range.

@petermattis petermattis changed the title int4 and “create_sequence” support sql: int4 and “create_sequence” support Feb 23, 2017
@petermattis petermattis added this to the 1.0 milestone Feb 23, 2017
@bdarnell bdarnell changed the title sql: int4 and “create_sequence” support sql: int4 support Mar 29, 2017
@maddyblue
Copy link
Contributor

We are already subtly broken here:

postegres:

postgres=# select -1234135568 << 2;
  ?column?  
------------
 -641574976

cockroach:

root@:26257/> select -1234135568 << 2;
+---------------------+
| (- 1234135568) << 2 |
+---------------------+
|         -4936542272 |
+---------------------+

This is happening because Postgres leaves that number as an "integer" (32-bits), resulting in shifting away of a 1 in the high bit.

@maddyblue
Copy link
Contributor

I vote we move this issue to the 1.1 milestone because I think it'll be hard to tackle it correctly in 2 days before the feature freeze.

@dianasaur323
Copy link
Contributor

Well, this is apparently a compatibility issue that a user has encountered, so we may have to provide a bug fix before 1.1 if it becomes a blocker.

@cuongdo cuongdo modified the milestones: Q2 2017, 1.0, 1.1 Apr 18, 2017
@cuongdo cuongdo assigned tso and unassigned jordanlewis May 15, 2017
@vivekmenezes
Copy link
Contributor

potential startup project for masha.

@jordanlewis
Copy link
Member

See also #14493, which if solved could be a potentially more holistic solution for this kind of thing.

m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 26, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 27, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 27, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 28, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 28, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 28, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 28, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 29, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 29, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 30, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
m-schneider pushed a commit to m-schneider/cockroach that referenced this issue Jun 30, 2017
with postgres support of numerical types.

Before this change we didn't support any of the types mentioned above.

After this change we'll support those types as alias and we will check
for overflow on INSERT and UPDATE. We currently won't support type checking
on mathematical operations, inline with how decimals are currently implemented.
Support for those operations would require a change to Datums, which is outside
of the scope for this change.

Closes cockroachdb#12481
Closes cockroachdb#14493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants