Subject Re: [firebird-support] Re: Followup newbie question about case of identifiers
Author Ann W. Harrison
John,

You asked,
>>> could we have a mode in a future version that skipped forcing
>>> identifiers parsed from SQL to upper case when they're not quoted?
>>>
I responded

>>Probably not... It's a SQL standard thing - identifiers are
>>case-insensitive and fold to upper case.

Your replied

> I don't read the standard quite that way

And you're right, of course. The standard has a much more complicated
discussion and can be interpreted as having internal inconsistencies.
However, what I understand you to ask for is that a table definition
like this:

create table "MiXedCaSe" ....

will create a table that can be accessed from a select statement like this:

select * from MiXedCaSe

and no interpretation of the standard allows that usage.


> So, this should be perfectly valid:
>
> create table a_mixed_Case_Identifier
> ( one_column integer,
> , "TWO_column" varchar(30)
> )
> ...
> select ONE_COLUMN, "TWO_column"
> from a_MIXED_case_identifier
>
> And the way FB behaves would seem to be consistent with this.

I think so. And, of course, if you don't use quotes at all you
can use upper and lower case as you wish.

create table a_mixed_Case_Identifier
( one_column integer,
TWO_column varchar(30));


select ONE_COLUMN, TWO_column
from a_MIXED_case_identifier

select One_Column, Two_Column
from a_MiXeD_CaSe_IdEnTiFiEr

What you can't do, without using quotes is have different tables called
myTable and MyTable.

>
> So, I concede that it is possible to read the standard as requiring
> the switch to upper-case for storage in the system tables

Firebird's system tables have little or nothing to do with the standard.
We switch to upper case because it seemed like the most convenient way
to handle the problem when it arose in 1980. We could have made
everything lower case, I suppose, but lower case was a pretty radical
thing then.

> Personally, I agree with treating them as
> equivalent and with the part about storing the variant that is first
> encountered.

I guess I don't see why it matters how the strings are stored in the
system tables if they're translated to upper case before being compared.
Why no do the translation once?

> Forcing everything to upper-case is giving up way too
> much in readability.

Your programs, procedures, triggers, etc. can used upper and lower case,
as long as you don't use quoted identifiers. In fact, the culprit here,
it seems to me, is neither the standard nor Firebird, but an overly
ambitious GUI tool that decided that all identifiers should be quoted.

> So, how do I get myself onto the standards
> committee next time around? ;-\

You or your company joins the standards organization (was $20K or so in
the early 80's). You brace yourself for a huge number of really boring
meetings. You face thousands of pages of e-mails on obscure issues that
no one but the author cares about at all. You learn the art of writing
proposals in the correct format... You abandon all hope...


Cheers,


Ann