Re: Delimited identifier brhavior

Поиск
Список
Период
Сортировка
От Darren Duncan
Тема Re: Delimited identifier brhavior
Дата
Msg-id 4CDC7CFC.4090207@darrenduncan.net
обсуждение исходный текст
Ответ на Delimited identifier brhavior  (Tatsuo Ishii <ishii@postgresql.org>)
Список pgsql-hackers
Tatsuo Ishii wrote:
> test=# select * from "t1"_foo;
> select * from "t1"_foo;
>  i 
> ---
> (0 rows)
> 
> It seems PostgreSQL thinks "t1"_foo is equivalent to t1. Is this an
> expected behavior?

That code looks badly written in any event.  Delimiters should be put around 
each part of an identifier or chain as a whole, such as:
  select * from "t1_foo";

Or with schema-delimited objects, for example, any of these:
  schema.table
  "schema".table
  schema."table"
  "schema"."table"

Personally, I treat all of my identifiers as being case-sensitive.  Knowing that 
Pg treats non-delimited identifiers as being lowercase, I write undelimited when 
the identifier is entirely lowercase, and I delimit ones that have any 
uppercase.  And by doing this consistently everything works correctly.  Since 
most of my identifiers are lowercase anyway, the code also reads cleanly in general.

-- Darren Duncan


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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Delimited identifier brhavior
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Delimited identifier brhavior