db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: more on system schema vs. user schema and character constants.
Date Thu, 31 May 2007 04:44:09 GMT
Mike Matrigali wrote:
> I am sort of confused at this point, what we expect to be working
> now and what should be.  What is the right way to write the
> following query against a the system schema?  Is there anyway to
> write the query without changing the default schema? :

Not sure if it's related or not but I just noticed this code in CastNode 
and there is other similar fragments elsewhere in ValueNodes.

     //set the collation type to be same as the current schema's
     //collation type. Collation derivation is already initialized
     //to correct value by default which is "IMPLICIT"
     getTypeServices().setCollationType(
   getLanguageConnectionContext().getDefaultSchema().getCollationType());

I think this is incorrect. During compilation the correct value to get 
the current schema is using the getSchemaDescriptor(null) call for any 
node. The current schema for compilation will not match the connection's 
current schema in some situations, such as compiling an action statement 
for a trigger, a sps for metadata queries and possibly for views as well.

If this code is frequent it might be worth creating a utility method in 
ValueNode as

  setSchemaCollation() {
     getTypeServices().setCollationType(
      getSchemaDescriptor(null).getCollationType());
  }

Dan.


Mime
View raw message