pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: [HACKERS] RULE (and ALTER TABLE) questions
2+ messages / 2 participants
[nested] [flat]

* Re: [HACKERS] RULE (and ALTER TABLE) questions
@ 1999-02-12 17:09 Hannu Krosing <hannu@trust.ee>
  1999-02-12 19:16 ` Re: [HACKERS] RULE (and ALTER TABLE) questions Jan Wieck <jwieck@debis.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Hannu Krosing @ 1999-02-12 17:09 UTC (permalink / raw)
  To: Jan Wieck <jwieck@debis.com>; +Cc: pgsql-hackers@postgreSQL.org; maillist@remo.demon.co.uk; pgsql-sql

Jan Wieck wrote:
>
> > 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.

But when doing that at the table creation time, then the table can
actually 
be defined as a view on storage table and rules for insert update and
delete
be defined for this view that do the actual data manipulation on the 
storage table.

Or is the rule system currently not capable for this ?

When some field is changed to UPPER-ONLY status using alter table, the
table 
could be renamed to staorage table and all the rules be created ?


And the other question - what is the status of ALTER TABLE commands - 
can we add/remove/disable constraints without recreating the table ?

Is constraint and index disabling supported at all ?

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [HACKERS] RULE (and ALTER TABLE) questions
  1999-02-12 17:09 Re: [HACKERS] RULE (and ALTER TABLE) questions Hannu Krosing <hannu@trust.ee>
@ 1999-02-12 19:16 ` Jan Wieck <jwieck@debis.com>
  0 siblings, 0 replies; 2+ messages in thread

From: jwieck@debis.com @ 1999-02-12 19:16 UTC (permalink / raw)
  To: hannu@trust.ee; +Cc: jwieck@debis.com; pgsql-hackers@postgreSQL.org; maillist@remo.demon.co.uk; pgsql-sql

> But when doing that at the table creation time, then the table can
> actually
> be defined as a view on storage table and rules for insert update and
> delete
> be defined for this view that do the actual data manipulation on the
> storage table.

    That's  IMHO  a too specific case to do it generally with the
    rule system.  Should be some kind of  constraint  handled  by
    the  parser  in  putting  an  UPPER()  func  node  around the
    targetlist expression.

    There could be more general support implemented,  in  that  a
    user can allways tell that a custom function should be called
    with the result of the TLE-expr before the value  is  dropped
    into the tuple on INSERT/UPDATE.


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) #





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-02-12 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-12 17:09 Re: [HACKERS] RULE (and ALTER TABLE) questions Hannu Krosing <hannu@trust.ee>
1999-02-12 19:16 ` Jan Wieck <jwieck@debis.com>

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