Drop index (serial column) failed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Stado |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Stado -> create table test(id serial, i int, c char, vc2 varchar(2)) partitioning key id on all;
OK
Stado -> create index idx on test(id);
OK
Stado -> show indexes on test;
+------
| indexname | isunique | columns |
+------
| IDX_SERIAL | NO | id |
| idx | NO | id |
+------
2 row(s).
It shows there are two indexes created. After reading the codes, I know that IDX_SERIAL is created by system. The index "idx" is not really created in underlying databases, while metadata is updated. This is because id is a serial column.
When trying to drop the index "idx", it failed.
Stado -> drop index idx;
SQLException: ERROR: ERROR: index "idx" does not exist
SqlDropIndex.java:
public void prepare() throws Exception {
...
if (columns.size() != 1
...
columns.get(0) != table.getSerial
The cause is when trying to create the index "idx", metadata is updated, and SyncCreateIndex
However, the serialcolumn is cached and not updated.
SysTable.java:
...
// Any table can have at most one serial column - this function
// will get hold of that
// particular sys column.
public SysColumn getSerialColumn() {
if (serialColumn == null) {
...
Related branches
Changed in stado: | |
status: | New → Fix Committed |
/src/org/ postgresql/ stado/metadata/ SysTable. java:
void readTableInfo( boolean force) throws XDBServerException {
...
add below line to clear cached data: