Re: [HACKERS] Re: [SQL] RULE questions.

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: [HACKERS] Re: [SQL] RULE questions.
Дата
Msg-id 36C315E3.24CD16C3@trust.ee
обсуждение исходный текст
Ответ на Re: [SQL] RULE questions.  ("D'Arcy" "J.M." Cain <darcy@druid.net>)
Ответы Re: [HACKERS] Re: [SQL] RULE questions.  (jwieck@debis.com (Jan Wieck))
Список pgsql-hackers
D'Arcy J.M. Cain wrote:
>
> This makes me think of two features missing in PostgreSQL that I would
> love to see.  I know it's probably to late to think about it now for
> 6.5 but I wonder what others think about this.
>
> First, as suggested above, how about an option to automatically convert
> data to upper case on entry?  I realize that triggers can do the job but
> it seems to be needed often enough that putting it into the definition
> for the field seems useful.  I guess a lower option would make sense too.

These could probably be implemened more effectively using rules. Having
the
rules generated automatically for simple cases would of course be nice,
but a warning at least should be given to user about creating the rule,
like it's currently done with primary key.

Or maybe it would be better to support virtual fields, like this :

create table people(
  first_name                 varchar(25),
  last_name                  varchar(25),
  upper_first_name VIRTUAL upper(first_name),
  upper_last_name  VIRTUAL upper(last_name),
  full_name        VIRTUAL (upper_first_name || ' ' || upper_last_name)
primary key
);

and then untangle this in the backend and create required rules and
indexes automatically ?

> Second, an option to CREATE INDEX to make the index case insensitive.

If you have this option on idex, how do you plan to make sure that the
index is actually used ?

It may be better to do it explicitly -

1. create index on upper(field)

2. use where upper(field) = 'MYDATA'

---------------
Hannu

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

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] date_part() BUG?
Следующее
От: jwieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [HACKERS] Re: [SQL] RULE questions.