Hi,

    as  proposed here comes the first patch for the query rewrite
    system.

    The tar archive contains mainly  a  little  test  suite  that
    would  fit  into  our regression tests. You'll find the patch
    itself (src.diff) in the directory ./ruletest.

    Changes:

        The syntax of CREATE RULE now accepts () in  addition  to
        []  to  group  the  action statements. I looked around to
        see, what ANSI says on CREATE RULE with no  luck.  But  I
        found what other database systems expect:

            Sybase,  Microsoft  SQL  Server  and  some others use
            CREATE RULE to add value checking on  table  columns.
            But  Sybase says for ANSI compliance the check clause
            on CREATE TABLE should be used.

            Ingres uses CREATE RULE where PostgreSQL uses  CREATE
            TRIGGER   (and   it   uses   ...   EXECUTE  PROCEDURE
            proname(args) too on it).

            AMOS uses ... DO  proname(args),  so  I  assume  this
            means trigger like in Ingres.

        INSTEAD  NOTHING  rules now create an action. It is a new
        query command type CMD_NOTHING that  is  treated  in  the
        rewrite  handler  as a null statement (thrown away). This
        allows now event qualification on instead  nothing  rules
        (formerly not supported).

        Queries  that  are  fired  in  by the rule system are now
        executed before the original query (if  it  still  exists
        after  rewriting).  This is required because a constraint
        delete query fired in by a delete  rule  would  become  a
        mergejoin (or the like) that does a scan on the triggered
        relation, but in the case of a delete it cannot find  the
        deleted  tuples if the delete takes place first. The same
        would happen if an update modifies the key  fields.  This
        might  interfere  with table constraints or triggers that
        check for foreign keys. It could  be  a  situation  where
        only  a  real  trigger  can  help (Bruce, did you receive
        PL/pgSQL?).

        Major change is that relation level rules  seem  to  work
        now  (as  far  as  I  tested  them). I was able to create
        insert/update/delete rules on a view that do the required
        actions    on   the   tables   behind   it.    Constraint
        update/delete   rules   work.    Instead    rules    with
        qualification  can  be  used to distribute insertion into
        different tables (user inserts every time into  the  same
        table  but  tuples  are  really  inserted  into different
        and/or multiple tables depending on qualifications).

    Left to do:

        Create more tests.

        There  are  still  problems  (don't  know  how  to   copy
        object...)  when  using  a  rule  after  creation without
        starting a new backend.  This must get fixed.

        Create more tests.

        I haven't had a look on attribute level rules.

        Create more tests.

        I still must look at the update new stuff. I  don't  know
        what  it  currently  does at all, but I know what it must
        do. It must modify (or  extend)  the  actual  parsetree's
        targetlist  entries  putting  in  the rule actions target
        list expressions.

        Create more tests.

        Last but not least: create much more tests (would someone
        be so kind to assist?)


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


begin 644 ruletest.tar.gz
M'XL(`%H@V#4"`^P]:W?32+)\C7Y%DV''3G`2/?T(`^<P0[C#+H39P%S.GMT]
MK&QW8H$M&4DF9-?<WWZKNEL/VVJI93LAS$8'8DM=KZZNJGZIR^%L3&,:Q4?W
MKN\BMMYQ''*/P&7I[-,P^:>X=$+:3KNMF[IN.U"J=_3V/>+<NX%K%L5N2,B]
MZ47T:5P"-^R[]_Z`5YBT?S0(O6D<'7W#]G<Z'4LW#"RU=?NN_;])^X<S_WWR
M\+!<):J7H>MMVY:UOPG&82;M;YL="TK;N@'^K]^U_[5?!P?:P0%Y"XT=D<`G
M+OGLT4L2C]R8>!&)Z)@.8K)/@G,HBMW^F"*XZP_)R(V(YT<TC(]FTZ$;TZ,A
M1:O!AS%UAP2-*")Q@`A].G(_4S(8!Q$E8^\C!0Z4A-0=<Z*'`*1I7)9WE/B4
M#@D:($'"9`Q_0BSE_(!#')`0R]_')OGLCF?`J&FTB&GL/2H',@'(K`*R`,@"
MH"(H*\_/DO"S\OPLLPH(^%E6%9`-0'85D`-`#DH.>A2`O*@`[;.1KXI17)4<
M$%3%P*JD-G$>!I,4C/,4)G#IQ2,R",`07#\F],LTI%'D!;XFRA<PR>6(AA3,
MZS$QY-25Y"\AWT?RYIKTDZI7`EDE^MG?)V=T0B=]&C+K%\*BFZ#G)8#'Y$5,
M(O<J0H1GK\F+TS=O3YX^(\].7IZ\/2'/SUZ_2MK=(.]^/3D[8:H;S,*0^O&A
MBVAO`N``[AM[$ZAY`(T1!I<1;Q8$-LD$PAZYH+&08JC]8ZK](]Q$@46H"X;(
M$8MU6$0T7HM9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41L?RK,.O3Q[#<;YZ505TDK-
MAP?10=^GYH-I-)V.E9JMY/#+`UO,-,,[N,67"XTO>SWP7"L8KUYG^0??^+>!
MN*]U!)H%M^JMC=NUK7':/R"6]N(>2N7'?*-+"EK(&SP.A:0G'9\*%/Q6YV6I
M2'X25!T[#^UX>_V)G[_,5=Y)`A//X_"P'QT>CK?+H^D`!-9PXMV;Z??[T:#O
M%X(@;GJ_V^IKR<8Z'+641YY$]OJXJQ+:YG^'<8EXE;;E;KRKC)2<42^\F>O'
MO$FM<F.;=RLE)R$"_A+O76']'+>O\*(U%\7\#)*1LM&`"`IG3?<PX%4ZBT'H
MZNM$479*H;OG[Y=FD=W<5@2>%`(9YQNI#Z?HQD;29Y^*#WA+E7(SN)LR<+$2
M,!D=L/-R9(B^WA[E6C^LO)]AN4)>64RK.RR'<9&4]',Z6].)X#5/34SA\*`+
M,-3)@(MX<Y5ZN(#12>%G4!Q9B5L4K_3J;#F+72A#M81$EH+]@'ZX&:!W2-<L
MOAK?<+S7J_.>+7^SY]XH^'5A,^G#@;-FQ;R48>]QH;;4:%/9>FM+6!O?VJ5>
M$#]YV3\("^+;P;Q;5X/)R^'!R_X]5?#[_7&T[V*_'9?CB<@\X;H0O(B!ETQ-
ME^AF-=\(A>\(JR'8K^`H79Q&^O7-[Q=GO_V78J3>/6P=%#RADNP$*06*]/TF
M$3GGD5>G!H?[*9ZMUXO(I-5LEV?\8GY9B*M'YT1[PHMQ\NU'+R9ZF-7T[!SV
MXB*,F:P7BXWES6MF8SM&[:I(T%;+H/MMK5OW^!J/!WC_D[R-Y@?,84;WOO\)
G/GUY_\<0WP!"[_\8#/YEQH_O_WC\/'X>/X^?'_;Y"ZF1A?@`\```
`
end

Mon, 17 Aug 1998 15:21:39 +0200 (MET DST)
jwieck@debis.com (Jan Wieck)
Rules: first fix
On Mon, 17 Aug 1998, Jan Wieck wrote:

> Hi,
> 
>     as  proposed here comes the first patch for the query rewrite
>     system.
> 
>     The tar archive contains mainly  a  little  test  suite  that
>     would  fit  into  our regression tests. You'll find the patch
>     itself (src.diff) in the directory ./ruletest.

	Applied...I'm a little confused though as to what in the ruletest
directory was suppose to be included, so I only included the
results/expected subdirectories.  scripts didn't seem to "fit" anywhere in
the regression tests...let me know if I'm wrong :(


Marc G. Fournier                                
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 


Mon, 17 Aug 1998 21:51:40 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: [HACKERS] Rules: first fix
> 
> On Mon, 17 Aug 1998, Jan Wieck wrote:
> 
> > Hi,
> > 
> >     as  proposed here comes the first patch for the query rewrite
> >     system.
> > 
> >     The tar archive contains mainly  a  little  test  suite  that
> >     would  fit  into  our regression tests. You'll find the patch
> >     itself (src.diff) in the directory ./ruletest.
> 
> 	Applied...I'm a little confused though as to what in the ruletest
> directory was suppose to be included, so I only included the
> results/expected subdirectories.  scripts didn't seem to "fit" anywhere in
> the regression tests...let me know if I'm wrong :(
> 
> 
> Marc G. Fournier                                

    Ooops - sorry. The files scripts/setup_ruletest.sql and
    scripts/run_ruletest.sql must go into .../regression/sql.
    And then these two must be added to .../regression/sql/tests.


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


Tue, 18 Aug 1998 09:30:06 +0200 (MET DST)
jwieck@debis.com (Jan Wieck)
Re: [HACKERS] Rules: first fix
On Tue, 18 Aug 1998, Jan Wieck wrote:

> > 
> > On Mon, 17 Aug 1998, Jan Wieck wrote:
> > 
> > > Hi,
> > > 
> > >     as  proposed here comes the first patch for the query rewrite
> > >     system.
> > > 
> > >     The tar archive contains mainly  a  little  test  suite  that
> > >     would  fit  into  our regression tests. You'll find the patch
> > >     itself (src.diff) in the directory ./ruletest.
> > 
> > 	Applied...I'm a little confused though as to what in the ruletest
> > directory was suppose to be included, so I only included the
> > results/expected subdirectories.  scripts didn't seem to "fit" anywhere in
> > the regression tests...let me know if I'm wrong :(
> > 
> > 
> > Marc G. Fournier                                
> 
>     Ooops - sorry. The files scripts/setup_ruletest.sql and
>     scripts/run_ruletest.sql must go into .../regression/sql.
>     And then these two must be added to .../regression/sql/tests.

	Fixed... :)

Marc G. Fournier                                
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 


Tue, 18 Aug 1998 21:15:04 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: [HACKERS] Rules: first fix
> as proposed here comes the first patch for the query rewrite system.

Hi Jan. I'm having trouble with views on my Linux system. The symptom is
that there is a segfault as memory is getting free'd at the end of a
query. The pg_view, pg_rule, and pg_user tables are all inaccessible as
views, though the underlying query which defines the view does work.

Unfortunately, I don't have any insight into the view stuff, and the
segfault is happening after everything executes so is far away from
where the bad or replicated pointer must be. afaik the problem has been
present for a month or two (your rules patches were applied Aug 17, so
that might be when).

Do you have any suggestions on where to look? I assume that you do no
develop under Linux because other Linux boxes (Tatsuo's at least) show
the same symptoms. I'd like to clear this up (I know that you are
developing new patches for the rules system, but...) since we have at
least two separate problems in the backend now (views and apparently
indices) and we need to reduce the discrepencies between the various
platforms to make progress.

An additional clue might be that I can do

  select viewname from pg_view;

but not

  select description from pg_view;
or
  select * from pg_view;

Actually, there are three views in the system after the initdb, and the
only queries which result in a segfault are ones involving the "text"
fields. Of course, two of the three views have only two columns, one of
which is a text field, but it is suspicious; I can see all of the other
columns in pg_user except the passwd field, for example. I'll keep
poking at it.

btw, compiling with assert checking enabled does not catch the problem.

Regards.

                     - Tom

Tue, 08 Sep 1998 00:32:51 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] Rules: first fix