Mamta Satoor wrote:
lots of thoughtful analysis...
The character set specification for string literals is not as well
defined as for <column definitions> but my proposal here will work
within SQL spec boundaries. SQL spec Section 5.3<literal>, Syntax Rule
14b says that if the character set is not specified for character
string literal, then character string literal's character set will be
the character set of the SQL-client module. Derby does not implement
SQL-client module, but definition of SQL-client module in Section 13.1
says that SQL-client module definition has mandatory <module name
clause> which is defined in Section 13.2 <module name clause>. The
Syntax Rule 4 in this section says that if a character set is not
specified for the SQL-client module, then it's character set is
implementation-defined. I think we can use this implementation-defined
character set for a SQL-client module to our advantage. We can define
Derby's implementation-defined character set for SQL-client module as
current schema's character set and hence the current schema's
character set will become string literal's character set. Hence, if
the string literal reference is made while the current schema is user
schema, then the character set associated with string literal will be
USER and if the string literal reference is made while the current
schema is system schema, then the character set associated with the
string literal will be SQL_IDENTIFER. Going this path will also make
sure that our metadata queries don't break.
I'm a bit uneasy about this interpretation. It seems to me that the
string literal has a default character set and collation. Those are
determined at the database level. They can be overridden at the session
level and the client-module level. I think your interpretation of
13.2/SR4 is a bit adventurous. To me, 13.2/SR4 says that there is a
single, implementation-defined implicit character set for a
client-module and not a number of different implicit character sets
which shift based on your current schema.
Regards,
-Rick