Subject Re: [firebird-support] Re: Lowecase identifiers
Author Ann W. Harrison
sqlsvr wrote:
> Thanks for the response. I typed this in FlameRobin:
>
> CREATE TABLE accounts
> (
> account_id INT NOT NULL PRIMARY KEY,
> account_name VARCHAR(25) NOT NULL
> );
>
> After I executed it, it showed up as "ACCOUNTS" in the tables list. Looking at the DDL in FlameRobin, it shows the DDL all capitalized.
>
> How do I get it show up as lowercased?
>

As you know, according to the SQL standard, undelimited identifiers
are compared by folding them to upper case. Firebird does not maintain
the original case, but folds them to upper case when storing them in
the system tables. You can get what you want - at a cost - by using
delimited identifiers. The cost is that all references to the
identifier must be in upper case and must match the definition
exactly.

CREATE TABLE "accounts"
(
"account_id" INT NOT NULL PRIMARY KEY,
"account_name" VARCHAR(25) NOT NULL
);

SELECT "account_id" FROM "accounts" WHERE "account_name" = 'Cuttihunk';

but not

SELECT "Account_Id" FROM "Accounts" WHERE "Account_Name" = 'Cuttihunk';

or

SELECT account_id FROM accounts WHERE account_name = 'Cuttihunk';


Yes, there has been discussion about storing the form of identifier
provided. It's not straightforward, as the indication in the system
tables that an identifier was delimited is the presence of a character
that's not allowed in an undelimited identifier folded to upper case
(e.g. space, lower case letter). Generally, increasing the size of
identifiers has higher priority than preserving the defined case.

Good luck,

Ann