final String columnName =
ParserUtils.getObjectName(parser.parseIdentifier());
if (parser.expectOptional("SET")) {
if (parser.expectOptional("STATISTICS")) {
final PgColumn column = table.getColumn(columnName);
if (column == null) {
throw new RuntimeException(MessageFormat.format(
Resources.getString("CannotFindTableColumn"),
columnName, table.getName(), parser.getString()));
}
column.setStatistics(parser.parseInteger());
} else if (parser.expectOptional("DEFAULT")) {
final String defaultValue = parser.getExpression();
if (table.containsColumn(columnName)) {
final PgColumn column = table.getColumn(columnName);
if (column == null) {
throw new RuntimeException(MessageFormat.format(
Resources.getString("CannotFindTableColumn"),
columnName, table.getName(),
parser.getString()));
}
column.setDefaultValue(defaultValue);
} else {
throw new ParserException(MessageFormat.format(
Resources.getString("CannotFindColumnInTable"),
columnName, table.getName()));
}
} else if (parser.expectOptional("STORAGE")) {
final PgColumn column = table.getColumn(columnName);
if (column == null) {
throw new RuntimeException(MessageFormat.format(
Resources.getString("CannotFindTableColumn"),
columnName, table.getName(), parser.getString()));
}
if (parser.expectOptional("PLAIN")) {
column.setStorage("PLAIN");
} else if (parser.expectOptional("EXTERNAL")) {
column.setStorage("EXTERNAL");
} else if (parser.expectOptional("EXTENDED")) {
column.setStorage("EXTENDED");
} else if (parser.expectOptional("MAIN")) {
column.setStorage("MAIN");
} else {
parser.throwUnsupportedCommand();
}
} else {
parser.throwUnsupportedCommand();