Subject Re: [firebird-support] Re: Followup newbie question about case of identifiers
Author Ann W. Harrison
John Craig wrote:
>
> Thanks for your gracious and informed reply. (I was on an IEEE working
> group for a standards proposal a long time back, but it wasn't so
> bad--and it didn't cost anything to participate.... :~\

I was on a CODASYL committee for data dictionaries and spent most of a
year trying to convince the members that a hierarchical name space had
merit... Left some scars.
>
> I have one more question for you and the group at large: If you
> install a collation that treats upper and lower-case letters as
> equivalent, would this issue arise?

Probably. The character set (let alone collation!) of system tables is
different from the default for data. One of the challenges we face is
moving toward cross-database operations and if the system tables have
different rules in different databases, that's going to be even harder
than it is now.


> That is, my table's named
> "data_table" (with the quotes so it's in the system tables in
> lower-case)

Why do you care about the case of the field and table names in the
system tables? It doesn't control what you call your tables in your
code - in your DDL - anywhere except in a metadata dump. Ah, I see.
You explain below. I respond below.

> Is such a collation even practical? (I realize it'd violate some
> provisions of the standard that allow "MyTableName" and "mytablename"
> to be distinct identifiers.)

That's a dumb thing to do, but completely within the standard, so I'd
hate to see us make a change that breaks it.

>
> The reason I'm interested in knowing that is a lot of the data I'm
> going to be storing is textual in nature and I don't want to have to
> worry about duplicate columns in all upper case or what-have-you
> (unless there really is no other option). Clearly case-insensitivity
> would be useful to many folks who've posted to this group.

Case insensitivity in data is important and we're gradually getting case
insensitive collations for most character sets. If you check the devel
list - archives at atkins and on ibphoenix.com - you'll find that
there's a new architecture for internationalization that will be
introduced for V2 or V2.1. It does include explicit rules for
generating case-insensitive variants of collating sequences.
>
> As far as identifiers are concerned, I'm now resigned to just dealing
> with ugly all upper-case identifiers--unless someone's working on
> collations that allow case insensitivity...and that would affect the
> lookup in the system tables.

As above, names in the system tables are handled differently from other
data. The design of names in system tables needs work - the names are
too short and although nominally Unicode-FSS, they're also one byte per
character...

> In any case, I'd be very interested in hearing from anyone who
> has a case-insensitive collation available to install or even plans to
> implement one; I might be able to help.

Adriano dos Santos Fernandes <adrianosf@...> is working on
internationalization, the umbrella which covers collations.
>
> ...In particular, if you
> then extract the DDL from the system tables, it not only wouldn't
> match what you'd originally used to create the tables (assuming you
> used lower-case in the first place), but it's unnecessarily hard to read.

The fact that the DDL in the extracted statement is also uppercase
doesn't help. An ambitious tool developer could give you the option of
controlling the case of the extracted file.
>
> The issue of comparing the SQL tokens to what's in the system tables
> is a whole n'other can of worms--case insensitivity would sure be
> helpful for lots of us (as I've already mentioned).

The current system is case insensitive unless you define your schema
using quoted identifiers.

>
> Ann wrote:
>>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.
>
> Actually, IBAccess apparently only quoted them because I entered them
> in lower-case

Which, to my mind, is excessively ambitious. If you'd entered quotation
marks, it should have reproduced them. Most people type mixed case - as
you said, it's easier to read and many of us have learned to use the
Shift key. That shouldn't doom us to quoting every identifier everywhere.
>
> I'd hate for the implementers of that tool to be blamed for my
> mistake!

Ah, but I'm perfectly willing to argue that the natural actions of a
naive user shouldn't lead to interminable discussions like this one...


Cheers,


Ann