提交 81d285d6 authored 作者: noelgrandin's avatar noelgrandin

Add support for CREATE TABLE TEST (ID BIGSERIAL) for Oracle compatibility. Patch from Jesse Long.

上级 a013176a
......@@ -22,6 +22,7 @@ Change Log
and then killing the process could result in a database that couldn't be opened (except when using
the recover tool).
</li><li>Support TRUNC(timestamp) for improved Oracle compatiblity.
</li><li>Add support for CREATE TABLE TEST (ID BIGSERIAL) for Oracle compatibility. Patch from Jesse Long.
</li></ul>
<h2>Version 1.3.171 (2013-03-17)</h2>
......
......@@ -3515,11 +3515,16 @@ public class Parser {
private Column parseColumnForTable(String columnName, boolean defaultNullable) {
Column column;
boolean isIdentity = false;
if (readIf("IDENTITY") || readIf("SERIAL")) {
if (readIf("IDENTITY") || readIf("BIGSERIAL")) {
column = new Column(columnName, Value.LONG);
column.setOriginalSQL("IDENTITY");
parseAutoIncrement(column);
column.setPrimaryKey(true);
} else if (readIf("SERIAL")) {
column = new Column(columnName, Value.INT);
column.setOriginalSQL("SERIAL");
parseAutoIncrement(column);
column.setPrimaryKey(true);
} else {
column = parseColumnWithType(columnName);
}
......
......@@ -355,6 +355,8 @@ public class Column {
}
if ("IDENTITY".equals(originalSQL)) {
originalSQL = "BIGINT";
} else if ("SERIAL".equals(originalSQL)) {
originalSQL = "INT";
}
String sequenceName;
while (true) {
......
......@@ -242,6 +242,12 @@ public class DataType {
// in many cases the value is in the cache
20
);
add(Value.INT, Types.INTEGER, "Int",
createDecimal(ValueInt.PRECISION, ValueInt.PRECISION, 0,
ValueInt.DISPLAY_SIZE, false, true),
new String[]{"SERIAL"},
20
);
add(Value.LONG, Types.BIGINT, "Long",
createDecimal(ValueLong.PRECISION, ValueLong.PRECISION, 0,
ValueLong.DISPLAY_SIZE, false, false),
......@@ -251,7 +257,7 @@ public class DataType {
add(Value.LONG, Types.BIGINT, "Long",
createDecimal(ValueLong.PRECISION, ValueLong.PRECISION, 0,
ValueLong.DISPLAY_SIZE, false, true),
new String[]{"IDENTITY", "SERIAL"},
new String[]{"IDENTITY", "BIGSERIAL"},
24
);
add(Value.DECIMAL, Types.DECIMAL, "BigDecimal",
......
......@@ -1169,6 +1169,18 @@ CREATE TABLE test (id int(25) NOT NULL auto_increment, name varchar NOT NULL, PR
drop table test;
> ok
CREATE TABLE test (id bigserial NOT NULL primary key);
> ok
drop table test;
> ok
CREATE TABLE test (id serial NOT NULL primary key);
> ok
drop table test;
> ok
CREATE MEMORY TABLE TEST(ID INT, D DOUBLE, F FLOAT);
> ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论