static UniqueKeyElement createAndAttachPrimaryKey(TableElement table,
String pKeyName) throws DBException {
String tableName = table.getName().getName();
String fullName = NameUtil.getAbsoluteMemberName(tableName, pKeyName);
TableElementImpl tableImpl = (TableElementImpl)table.getElementImpl();
IndexElementImpl indexImpl =
new IndexElementImpl(tableImpl, fullName, true);
IndexElement index = new IndexElement(indexImpl, table);
index.setUnique(true);
UniqueKeyElementImpl pKeyImpl = new UniqueKeyElementImpl();
UniqueKeyElement pKey = new UniqueKeyElement(pKeyImpl, table, index);
pKey.setName(DBIdentifier.create(fullName));
pKey.setPrimaryKey(true);
table.addKey(pKey);
table.addIndex(pKey.getAssociatedIndex());
return pKey;
}