[HACKERS] Case sensitivity in identifiers (fwd)

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема [HACKERS] Case sensitivity in identifiers (fwd)
Дата
Msg-id 160917146c0466ccf8fb95b7b2ae132a
обсуждение исходный текст
Список pgsql-hackers
> I'd agree with the principle of case insensitivity, particularly in
> the interests of ANSI compatibility.
>
> Having just fetched and built 6.1, however, I am appalled at the way
> it has been done. Perhaps it had to be that way, but off the top of my
> head, I can't see why. I use cases as a matter of style, not syntax,
> and 6.1 has thrown away all my cases. Wouldn't it be possible to keep
> the identifiers as defined, but ignore the case at run-time, so to
> speak? All I want to do is this:
>
> => create table FOO (ID int4, Field1 char16, FieldTwo varchar(80));
> => \d FOO
> Table    = FOO
> +----------------------------------+----------------------------------+-------+
> |              Field               |              Type                | Length|
> +----------------------------------+----------------------------------+-------+
> | ID                               | int4                             |     4 |
> | Field1                           | char16                           |    16 |
> | FieldTwo                         | varchar                          |    80 |
> +----------------------------------+----------------------------------+-------+
>
> or somesuch.
>
> Right now saying '\d FOO' says 'Couldn't find table FOO!' so somebody
> missed a bit of case-sensitivity code somewhere, but I'm sure you see

I will check on this.  Looks like a bug.

> the point: *store* the identifiers as given, but allow access to them
> with insensitivity.
>
> Such a change would also mean that third-party apps which read the
> identifiers would not break (at least for this reason). In particular
> I use PHP/FI, now I know that there's a 'fix' but (i) I was happy with
> my tried, tested and tuned httpd, and (ii) there must be other cases
> like this; it's not as if PHP/FI was abusing the Postgres95 API
> particularly.
>
> While ANSI SQL may be case insensitive, does it insist that everything
> is forced to lower case? Does it break compliance to implement what I
> have suggested? Isn't this the elegant way to do it? If you'd done it
> this way, how many people would have noticed?
>
> Do I hear howling from the implementors here?

You have a good point here.  I can see a value in keeping case when
creating fields, but allowing any case to access it.  Is that the basis
of the argument.

Right now, we lowercase arguments when the come in from the parser.  We
could preserve case for Create-type statements, and force lowercase on
all comparisons, but that is a big job, and I think we questioned the
value of it.

- --
Bruce Momjian
maillist@candle.pha.pa.us

------------------------------

End of hackers-digest V1 #403
*****************************

В списке pgsql-hackers по дате отправления: