Peter Nabbefeld wrote: >> > I've looked at it. As I've seen, LLC supports only to get the default > schema (so it seems to be difficult to get a non-default schema for > compilation; probably "getSchema(String name)" should be added to LLC).
No, code gets schema descriptors all the time during compilation, there are methods to get a schema desciptor from a name in QueryTreeNode, which is the root class for all compilation nodes. Since Java is an o-o language there is no need to add get methods for everything to the LCC, instead the LCC provides methods to get the object that manages the entity. For schemas, tables etc. the object is the DataDictionary, thus that class has the get methods for various catlog entries. > However, if there is no default user schema, default schema should be > "APP", not null (if I've understood the comment for "protected > SchemaDescriptor initDefaultSchemaDescriptor() ..." in > GenericLanguageConnectionContext correct). The default schema is a schema name corresponding to the user name if the connection has not executed a SET SCHEMA statement. In Derby if that schema has not been created, then the current schema is still that schema, even though it doesn't exist. The schema descriptor representing this "virtual" schema will have a null UUID, indicating it is not persistent. The APP is the default user name, not the default schema name, though the comments in some areas of the code are misleading on this. Also I think the concept of a "default" schema is wrong, I think the code should refer to the "current" schema. Since once a connection has performed a SET SCHEMA then there is no notion of a default schema. There is no way to get back to the original schema without an explict set schema with the name, nothing default about this. Not sure if this is relevant to this bug or not, I haven't looked at it. The bug may be more related to if a SQL statement does not depend on the current schema, ie. all names are schema qualified, then its compilation schema is null. The code that persists a trigger may then not be coded to handle a null compliation schema. Dan.
