736
public void alterSequence(Session session, TableName sequenceName, Sequence newDefinition)
738
logger.trace("altering sequence {}", sequenceName);
740
// Lock the table, if any, that this sequence is an identity generator for
741
// Note: If/when we have expression DEFAULT values, they will need checked too.
742
List<Integer> tableIDs = new ArrayList<>();
743
txnService.beginTransaction(session);
745
AkibanInformationSchema ais = getAIS(session);
746
Sequence s = ais.getSequence(sequenceName);
748
for(UserTable table : ais.getUserTables().values()) {
749
for(Column column : table.getColumnsIncludingInternal()) {
750
if(column.getIdentityGenerator() == s) {
751
tableIDs.add(table.getTableId());
757
txnService.commitTransaction(session);
759
txnService.rollbackTransactionIfOpen(session);
762
lockTables(session, tableIDs);
763
txnService.beginTransaction(session);
765
AkibanInformationSchema ais = getAIS(session);
766
Sequence oldSeq = ais.getSequence(sequenceName);
768
throw new NoSuchSequenceException(sequenceName);
770
schemaManager().alterSequence(session, sequenceName, newDefinition);
773
store().deleteSequences(session, Collections.singleton(oldSeq));
775
txnService.commitTransaction(session);
777
txnService.rollbackTransactionIfOpen(session);
736
782
public void dropSchema(Session session, String schemaName)
738
784
logger.trace("dropping schema {}", schemaName);