FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.24k stars 215 forks source link

Allow user to get original names of meta-objects (tables, fields, views, SP(with params), etc) [CORE4455] #4775

Open firebird-automations opened 10 years ago

firebird-automations commented 10 years ago

Submitted by: Nick (nick)

Attachments: screen4.gif

It will be useful in IDEs. case 1: create table FirebirdFeatures(Id integer not null, ShortDescription varchar(200), LongDescription blob sub_type text); case 2: create table "FirebirdFeatures"("Id" integer not null, "ShortDescription" varchar(200), "LongDescription" blob sub_type text); After it in system tables we have: case 1: RDB$RELATIONS.RDB$RELATION_NAME = 'FIREBIRDFEATURES'; RDB$RELATION_FIELDS.RDB$FIELD_NAME = 'ID'; RDB$RELATION_FIELDS.RDB$FIELD_NAME = 'SHORTDESCRIPTION'; RDB$RELATION_FIELDS.RDB$FIELD_NAME = 'LONGDESCRIPTION'; All in UPPERCASE, and original case is lost forever.

case 2: RDB$RELATIONS.RDB$RELATION_NAME = 'FirebirdFeatures'; RDB$RELATION_FIELDS.RDB$FIELD_NAME = 'Id'; RDB$RELATION_FIELDS.RDB$FIELD_NAME = 'ShortDescription'; RDB$RELATION_FIELDS.RDB$FIELD_NAME = 'LongDescription'; All in original case. It's ok. But now we must add double quotes (" ") in any sql: select "Id", "ShortDescription, "LongDescription" from "FirebirdFeatures";

So. Case 1 is unusable because of original case lost. Case 2 is unusable because of double quotes everywhere in sql code.

I suggest to add fields RDB$SRC_*_NAME to all system tables with system object names, and put there names in original case. So we can get it from there and use in query builder (for example) with original word-cases, like in attached picture.

firebird-automations commented 10 years ago
Modified by: Nick (nick) Attachment: screen4\.gif \[ 12540 \]
firebird-automations commented 10 years ago
Modified by: Nick (nick) description: It will be useful in IDEs\. case 1: create table FirebirdFeatures\(Id integer not null, ShortDescription varchar\(200\), LongDescription blob sub\_type text\); case 2: create table "FirebirdFeatures"\("Id" integer not null, "ShortDescription" varchar\(200\), "LongDescription" blob sub\_type text\); After it in system tables we have: case 1: RDB$RELATIONS\.RDB$RELATION\_NAME = 'FIREBIRDFEATURES'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'ID'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'SHORTDESCRIPTION'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'LONGDESCRIPTION'; All in UPPERCASE, and original case is lost forewer\. case 2: RDB$RELATIONS\.RDB$RELATION\_NAME = 'FirebirdFeatures'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'Id'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'ShortDescription'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'LongDescription'; All in original case\. It's ok\. But now we must add double quotes \(" "\) in any sql: select "Id", "ShortDescription, "LongDescription" from "FirebirdFeatures"; So\. Case 1 is unusable because of original case lost\. Case 2 is unusable because of double quotes everywhere in sql code\. I suggest to add fields RDB$SRC\_\*\_NAME to all system tables with system object names, and put there names in original case\. So we can get it from there and use in query builder \(for example\) with original word\-cases, like in attached picture\. =\> It will be useful in IDEs\. case 1: create table FirebirdFeatures\(Id integer not null, ShortDescription varchar\(200\), LongDescription blob sub\_type text\); case 2: create table "FirebirdFeatures"\("Id" integer not null, "ShortDescription" varchar\(200\), "LongDescription" blob sub\_type text\); After it in system tables we have: case 1: RDB$RELATIONS\.RDB$RELATION\_NAME = 'FIREBIRDFEATURES'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'ID'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'SHORTDESCRIPTION'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'LONGDESCRIPTION'; All in UPPERCASE, and original case is lost forever\. case 2: RDB$RELATIONS\.RDB$RELATION\_NAME = 'FirebirdFeatures'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'Id'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'ShortDescription'; RDB$RELATION\_FIELDS\.RDB$FIELD\_NAME = 'LongDescription'; All in original case\. It's ok\. But now we must add double quotes \(" "\) in any sql: select "Id", "ShortDescription, "LongDescription" from "FirebirdFeatures"; So\. Case 1 is unusable because of original case lost\. Case 2 is unusable because of double quotes everywhere in sql code\. I suggest to add fields RDB$SRC\_\*\_NAME to all system tables with system object names, and put there names in original case\. So we can get it from there and use in query builder \(for example\) with original word\-cases, like in attached picture\.
firebird-automations commented 10 years ago
Modified by: Nick (nick) Component: Engine \[ 10000 \]
firebird-automations commented 10 years ago

Commented by: @dyemanov

Duplicates CORE1645?

firebird-automations commented 10 years ago

Commented by: Nick (nick)

No. I just want to have ability to extract original names as they was defined in DDL (without uppercasing). I want to have ability to extract TtT and FfF from system tables after "create table TtT(FfF integer)". That's all.

firebird-automations commented 10 years ago

Commented by: @mrotteveel

I don't understand the use case. Without quoting an objectname is case insensitive and the implementation in Firebird does this by storing it uppercase, and by uppercasing unquoted objectnames when parsing queries. I don't see why it would be relevant (except for aesthetics) to know the original case at creation time. If you want to preserve the case, use quoted objectnames.

firebird-automations commented 10 years ago

Commented by: Nick (nick)

I want work with human-readable identifiers, not uppercased. And don't want to use quotes. I want work with human-readable identifiers in sql tools (intellisence, sql scripts), in codegenerators, in report generators, etc. I have some self-made tools where I can use this.

firebird-automations commented 10 years ago

Commented by: Nick (nick)

deleted

firebird-automations commented 10 years ago

Commented by: Sean Leyne (seanleyne)

@Nick,

So, are you withdrawing this case/tracker issue?

firebird-automations commented 8 years ago

Commented by: Nick (nick)

Sean Leyne,

No. Original case still needed to be saved.

firebird-automations commented 8 years ago

Commented by: Sean Leyne (seanleyne)

Nick,

My question was about this case, your reply was about the "original case" -- which too me refers to the case that Dmitry quoted.

So, this case appears to be a duplicate, and/or a fight against how SQL standard defines the treatment of non-quoted identifiers (ie. case insensitive, without retaining the original casing).