mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
Improvement CORE-5431 - Support for DROP IDENTITY clause.
This commit is contained in:
parent
9fd55f7660
commit
127dddfe74
@ -25,6 +25,9 @@
|
||||
|
||||
## Improvements
|
||||
|
||||
* [CORE-5430](http://tracker.firebirdsql.org/browse/CORE-5431): Support for DROP IDENTITY clause
|
||||
Contributor(s): Adriano dos Santos Fernandes
|
||||
|
||||
* [CORE-5430](http://tracker.firebirdsql.org/browse/CORE-5430): Support for INCREMENT option in identity columns
|
||||
Contributor(s): Adriano dos Santos Fernandes
|
||||
|
||||
|
@ -19,7 +19,8 @@ Syntax:
|
||||
|
||||
<alter column definition> ::=
|
||||
<name> RESTART [ WITH <value> ] |
|
||||
<name> SET INCREMENT [ BY ] <value>
|
||||
<name> SET INCREMENT [ BY ] <value> |
|
||||
<name> DROP IDENTITY
|
||||
|
||||
Syntax rules:
|
||||
- The type of an identity column must be an exact number type with zero scale. That includes:
|
||||
@ -74,3 +75,9 @@ select * from objects order by id;
|
||||
2 Book
|
||||
10 Computer
|
||||
15 Pencil
|
||||
|
||||
alter table objects
|
||||
alter id set increment by 2;
|
||||
|
||||
alter table objects
|
||||
alter id drop identity;
|
||||
|
@ -7847,6 +7847,21 @@ void AlterRelationNode::modifyField(thread_db* tdbb, DsqlCompilerScratch* dsqlSc
|
||||
}
|
||||
END_MODIFY
|
||||
}
|
||||
else if (clause->dropIdentity)
|
||||
{
|
||||
if (RFR.RDB$GENERATOR_NAME.NULL)
|
||||
{
|
||||
// msg 285: "Column @1 is not an identity column"
|
||||
status_exception::raise(Arg::PrivateDyn(285) << field->fld_name);
|
||||
}
|
||||
|
||||
DropSequenceNode::deleteIdentity(tdbb, transaction, RFR.RDB$GENERATOR_NAME);
|
||||
|
||||
MODIFY RFR
|
||||
RFR.RDB$GENERATOR_NAME.NULL = TRUE;
|
||||
RFR.RDB$IDENTITY_TYPE.NULL = TRUE;
|
||||
END_MODIFY
|
||||
}
|
||||
else if (clause->identityRestart || clause->identityIncrement.specified)
|
||||
{
|
||||
bool found = false;
|
||||
|
@ -1383,6 +1383,7 @@ public:
|
||||
field(NULL),
|
||||
defaultValue(NULL),
|
||||
dropDefault(false),
|
||||
dropIdentity(false),
|
||||
identityRestart(false),
|
||||
computed(NULL)
|
||||
{
|
||||
@ -1391,6 +1392,7 @@ public:
|
||||
dsql_fld* field;
|
||||
NestConst<ValueSourceClause> defaultValue;
|
||||
bool dropDefault;
|
||||
bool dropIdentity;
|
||||
bool identityRestart;
|
||||
Nullable<SINT64> identityRestartValue;
|
||||
Nullable<SINT64> identityIncrement;
|
||||
|
@ -3944,6 +3944,14 @@ alter_op($relationNode)
|
||||
clause->identityIncrement = $6;
|
||||
$relationNode->clauses.add(clause);
|
||||
}
|
||||
| col_opt symbol_column_name DROP IDENTITY
|
||||
{
|
||||
RelationNode::AlterColTypeClause* clause = newNode<RelationNode::AlterColTypeClause>();
|
||||
clause->field = newNode<dsql_fld>();
|
||||
clause->field->fld_name = *$2;
|
||||
clause->dropIdentity = true;
|
||||
$relationNode->clauses.add(clause);
|
||||
}
|
||||
| ALTER SQL SECURITY DEFINER
|
||||
{
|
||||
RelationNode::AlterSqlSecurityClause* clause =
|
||||
|
Loading…
Reference in New Issue
Block a user