Thread: TODO item: support triggers on columns

TODO item: support triggers on columns

From
"Chris Mair"
Date:
Hello,

I'd like to start working on the following TODO item:
Referential Integrity / Support triggers on columns

Is somebody else already working on this?

Bye :)
Chris.





Re: TODO item: support triggers on columns

From
Bruce Momjian
Date:
Chris Mair wrote:
> Hello,
> 
> I'd like to start working on the following TODO item:
> Referential Integrity / Support triggers on columns
> 
> Is somebody else already working on this?

No one, I think.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: TODO item: support triggers on columns

From
Alvaro Herrera
Date:
On Fri, Mar 11, 2005 at 11:32:04AM -0500, Bruce Momjian wrote:
> Chris Mair wrote:
> > Hello,
> > 
> > I'd like to start working on the following TODO item:
> > Referential Integrity / Support triggers on columns
> > 
> > Is somebody else already working on this?
> 
> No one, I think.

Isn't this the REFERENCING clause?  I think there was a partial patch
submitted already for this.

-- 
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
<Schwern> It does it in a really, really complicated way
<crab> why does it need to be complicated?
<Schwern> Because it's MakeMaker.


Re: TODO item: support triggers on columns

From
Bruce Momjian
Date:
Alvaro Herrera wrote:
> On Fri, Mar 11, 2005 at 11:32:04AM -0500, Bruce Momjian wrote:
> > Chris Mair wrote:
> > > Hello,
> > > 
> > > I'd like to start working on the following TODO item:
> > > Referential Integrity / Support triggers on columns
> > > 
> > > Is somebody else already working on this?
> > 
> > No one, I think.
> 
> Isn't this the REFERENCING clause?  I think there was a partial patch
> submitted already for this.

The patch appears unrelated to column-level triggers:
http://momjian.postgresql.org/cgi-bin/pgpatches2

---------------------------------------------------------------------------

The attached patch adds the optional REFERENCES syntax in CREATE TRIGGER
statement to make an automatic alias for OLD/NEW record during trigger
setup.  The implementation of this new feature makes CREATE TRIGGER
command more compatible to SQL standard, and allows the future
implementation of executing SQL commands in trigger action.

After the implementation, the extended syntax of statement is as
follows.

CREATE TRIGGER name BEFORE|AFTER   INSERT|DELETE|UPDATE [OR...] ON tablename   [REFERENCING OLD|NEW [AS] identifier]
[FOR[EACH] ROW|STATEMENT]   EXECUTE PROCEDURE funcname (arguments)
 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: TODO item: support triggers on columns

From
Chris Mair
Date:
> > > I'd like to start working on the following TODO item:
> > > Referential Integrity / Support triggers on columns
> > > 
> > > Is somebody else already working on this?
> > 
> > No one, I think.
> 
> Isn't this the REFERENCING clause?  I think there was a partial patch
> submitted already for this.


Those are two different things:
http://www.postgresql.org/docs/8.0/static/sql-createtrigger.html#SQL-CREATETRIGGER-COMPATIBILITY

Bye, Chris.




Re: TODO item: support triggers on columns

From
Robert Treat
Date:
On Friday 11 March 2005 12:18, Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > On Fri, Mar 11, 2005 at 11:32:04AM -0500, Bruce Momjian wrote:
> > > Chris Mair wrote:
> > > > Hello,
> > > >
> > > > I'd like to start working on the following TODO item:
> > > > Referential Integrity / Support triggers on columns
> > > >
> > > > Is somebody else already working on this?
> > >
> > > No one, I think.
> >
> > Isn't this the REFERENCING clause?  I think there was a partial patch
> > submitted already for this.
>
> The patch appears unrelated to column-level triggers:
>
>  http://momjian.postgresql.org/cgi-bin/pgpatches2
>

It is unrelated, but AFAIK Greg Mullane is working on this (actual column 
based triggers) and has the intial workings of a patch already in 
progress.... I'm CC'ing him so he can clarify but I'd hold off till you spoke 
with him... and we should probably update the TODO once he speaks up as well. 

-- 
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


Re: TODO item: support triggers on columns

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> I'd like to start working on the following TODO item:
> Referential Integrity / Support triggers on columns
>
> Is somebody else already working on this?

Sorry for not jumping in earlier. As Rob said, I am working on
column-level support for triggers. I did not have my name addded
to the TODO list as I wanted to at least get a proof of concept
going first to make sure I could undertake it. I am partway there,
but there are still a lot of rough edges. I guess at this point
I should formally put my name on the TODO, and can bail out if
it gets over my head?

By the way, does anyone know what the tgattr field in pg_triggers
is for? It's allocated but never populated, and would be perfect
for my purposes on this patch, but I don't want to use it if it is
being reserved for something else.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200503121915
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFCM4ZwvJuQZxSWSsgRAhesAKCXi468EyjJ77yMW83Zuoy9glm6XACgxBod
3PZ+l26fRrPY5glMpY+6gxM=
=P+cR
-----END PGP SIGNATURE-----




Re: TODO item: support triggers on columns

From
Chris Mair
Date:
> > I'd like to start working on the following TODO item:
> > Referential Integrity / Support triggers on columns
> >
> > Is somebody else already working on this?
> 
> Sorry for not jumping in earlier. As Rob said, I am working on
> column-level support for triggers. I did not have my name addded
> to the TODO list as I wanted to at least get a proof of concept
> going first to make sure I could undertake it. I am partway there,
> but there are still a lot of rough edges. I guess at this point
> I should formally put my name on the TODO, and can bail out if
> it gets over my head?

Ok!
Keep us up to date.

Bye, Chris :)



Re: TODO item: support triggers on columns

From
Tom Lane
Date:
"Greg Sabino Mullane" <greg@turnstep.com> writes:
> By the way, does anyone know what the tgattr field in pg_triggers
> is for?

http://developer.postgresql.org/docs/postgres/catalog-pg-trigger.html
says "currently unused" and a desultory search through the sources
confirms that.  I imagine it was put there with the intent of adding
column info later on.  However, being a fixed-width array, I don't
actually see that it would be useful for anything much ... you'd at
least want to change it to a normal array.

BTW, if you don't have a convenient way of grepping the entire PG
source tree and quickly viewing all the hits on a particular symbol,
I *highly* recommend setting up something that can do that.  I use
emacs + glimpse but there are probably newer tools out there.
        regards, tom lane


Re: TODO item: support triggers on columns

From
Bruce Momjian
Date:
Greg Sabino Mullane wrote:
[ There is text before PGP section. ]
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> > I'd like to start working on the following TODO item:
> > Referential Integrity / Support triggers on columns
> >
> > Is somebody else already working on this?
> 
> Sorry for not jumping in earlier. As Rob said, I am working on
> column-level support for triggers. I did not have my name addded
> to the TODO list as I wanted to at least get a proof of concept
> going first to make sure I could undertake it. I am partway there,
> but there are still a lot of rough edges. I guess at this point
> I should formally put my name on the TODO, and can bail out if
> it gets over my head?

Added to TODO.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: TODO item: support triggers on columns

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Tom Lane wrote:
> http://developer.postgresql.org/docs/postgres/catalog-pg-trigger.html
> says "currently unused" and a desultory search through the sources
> confirms that.  I imagine it was put there with the intent of adding
> column info later on.  However, being a fixed-width array, I don't
> actually see that it would be useful for anything much ... you'd at
> least want to change it to a normal array.

I grepped the sources and saw the same: I just wanted to make sure
that nobody had any plans on it. If so, speak now, for I am planning on
using it. As for the type, I presume you mean something like grolist in
pg_group would be more applicable than indkey in pg_index.

> BTW, if you don't have a convenient way of grepping the entire PG
> source tree and quickly viewing all the hits on a particular symbol,
> I *highly* recommend setting up something that can do that.  I use
> emacs + glimpse but there are probably newer tools out there.

I actually use emacs and glimpse, but not together. I won't bother to
ask if emacs has a glimpse-mode: it's emacs after all, so of course
it does. :) I'll have to give it a shot.

Thank,
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200503140712
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFCNX/AvJuQZxSWSsgRAiq8AKD6+5GGa8Eh28acVHvx/0RZWpKBwwCgyDeD
GojL9ZIFiUUDT0ZjIsuQ4Dk=
=QivK
-----END PGP SIGNATURE-----