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

From: jwieck(at)debis(dot)com (Jan Wieck)
To: hannu(at)trust(dot)ee (Hannu Krosing)
Cc: pgsql-hackers(at)postgreSQL(dot)org, maillist(at)remo(dot)demon(dot)co(dot)uk, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: [SQL] RULE questions.
Date: 1999-02-11 18:01:49
Message-ID: m10B0Qv-000EBRC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

>
> 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.

No it can't.

Such a rule would look like

CREATE RULE xxx AS ON INSERT TO this_table
DO INSTEAD INSERT INTO this_table ...

The rule system will be triggerd on an INSERT INTO
this_table, rewrite and generate another parsetree that is an
INSERT INTO this_table, which is recursively rewritten again
applying rule xxx...

That's an endless recursion. A rule can never do the same
operation to a table it is fired for.

The old pre-Postgres95 university version (Postgres release
4.2) had the possibility to define rules that UPDATE NEW.
They where buggy and didn't worked sometimes at all. Instead
of fixing them, this functionality got removed when Postgres
became 95 :-(

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-02-11 18:55:15 Re: [HACKERS] TIME QUALIFICATION
Previous Message Hannu Krosing 1999-02-11 17:39:47 Re: [HACKERS] Re: [SQL] RULE questions.

Browse pgsql-sql by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1999-02-11 19:03:48 Re: [HACKERS] Re: [SQL] RULE questions.
Previous Message Hannu Krosing 1999-02-11 17:39:47 Re: [HACKERS] Re: [SQL] RULE questions.