You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Mamta A. Satoor (JIRA)" <ji...@apache.org> on 2007/09/05 07:54:32 UTC

[jira] Resolved: (DERBY-2946) In soft upgrade mode, the metadata queries do not get compiled in SYS schema. This will cause problems in future releases of Derby.

     [ https://issues.apache.org/jira/browse/DERBY-2946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mamta A. Satoor resolved DERBY-2946.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 11.0.0.0

Revision 572880 fixes this Jira entry. The commit comments are as follows. Thanks to Knut for his suggestion on code change. That did the trick.

Commit comments

DERBY-2946

The character string literals take their collation from the current compilation schema. Derby's metadata queries have lots of comparisons where a character string literal is compared with a character string column from SYS schema. The character string columns from SYS schema have the collation of UCS_BASIC. If the metadata queries get run with user schema as current compilation schema, then the character string constants in metadata queries will get a collation of territory based and this mismatch in collation of character string constants and character string columns will cause the metadata queries to fail. This situation can arise in the current softupgrade code. In softupgrade mode, we do not ensure that the current compilation schema is SYS schema. A simple change in GenericLanguageConnectionContext(GLCC) takes care of that problem. In GLCC, with this checkin, we check if the query being executed is a metadata query and if yes, then we should set the current compilation schema to be SYS schema for that metadata query execution. This takes care of the soft upgrade problem. Outside of soft upgrade mode, we do not have problems with metadata queries because during a normal run/hard upgrade, we go to SYSSTATEMENTS to run metadata queries and that code path ensures that the current compilation schema is SYS schema.



> In soft upgrade mode, the metadata queries do not get compiled in SYS schema. This will cause problems in future releases of Derby.
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2946
>                 URL: https://issues.apache.org/jira/browse/DERBY-2946
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Mamta A. Satoor
>             Fix For: 11.0.0.0
>
>
> EmbedDatabaseMetaData implements metadata queries. The implementation of metadata queries in EmbedDatabaseMetaData checks if we are in soft upgrade mode (getPreparedQuery() has following code)
> if (notInSoftUpgradeMode())
> 	s = getPreparedQueryUsingSystemTables(queryName, net);
> else {
> 	try {
> 		//Can't use stored prepared statements because we are in soft upgrade
> 		//mode and hence need to get metadata sql from metadata.properties file 
> 		//or metadata_net.properties
> 		String queryText = getQueryFromDescription(queryName, net);
> 		s = getEmbedConnection().prepareMetaDataStatement(queryText);
> 	} catch (Throwable t) {
> 		throw handleException(t);
> 	} 
> }
> So, when running in soft upgrade mode, we do not go through SYSSTATEMENT but this will cause the metadata query to run in whatever the current schema may be rather than in SYS schema. This is not a problem in Derby 10.3 release because during soft upgarde, the collation will always be UCS_BASIC and hence collation mismatch can't happen.
> But in Derby 10.3, a user can create a database with territory based collation. When such a database will be in soft upgrade mode for say Derby 10.4, the metadata queries will run into problem if they are run in a user schema. This is because in soft upgrade mode, we do not go through SYSSTATEMENTS and instead compile the metadata queries in current schema. If the current schema is user schema, then character string literals in metadata queries will get the collation type of territory based and when compared with character string colunms from SYS tables with collation type of UCS_BASIC, we will end up getting compilation error for the metadata queries. So, before the next release, we will have to fix this problem. One solution may be to somehow make the current compilation schema as SYS when running the metadata queries in soft upgrade mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.