From: jwieck@debis.com
To: hannu@trust.ee
Cc: pgsql-hackers@postgreSQL.org
Cc: maillist@remo.demon.co.uk
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [HACKERS] Re: [SQL] RULE questions.
Date: Thu, 11 Feb 1999 19:01:49 +0100 (MET)
Message-ID: <m10B0Qv-000EBRC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <36C315E3.24CD16C3@trust.ee>
>
> 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@debis.com (Jan Wieck) #
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jwieck@debis.com, hannu@trust.ee, pgsql-hackers@postgreSQL.org, maillist@remo.demon.co.uk
Subject: Re: [HACKERS] Re: [SQL] RULE questions.
In-Reply-To: <m10B0Qv-000EBRC@orion.SAPserv.Hamburg.dsh.de>
References: <36C315E3.24CD16C3@trust.ee> <m10B0Qv-000EBRC@orion.SAPserv.Hamburg.dsh.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox