Re: PostgreSQL, Triggers
| From: | Martin Marques | Date: | Sun, 19 Oct 2003 23:00:56 +0000 |
| Subject: | Re: PostgreSQL, Triggers | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31134@lists.php.net to get a copy of this message | ||
El Dom 19 Oct 2003 13:54, Ling escribió:
> Hello there.
> Can anybody help me with Postgresql triggers?
> what I need is a trigger which inrements value in field "total_rows.rows"
> if I insert new row in table "zzz"...
>
> CAREATE TABLE zzz (
> ...
> ...
> );
> CREATE TABLE total_rows (
> table_name VARCHAR(32),
> total_rows BIGINT,
> CONSTRAINT pk_total_rows PRIMARY KEY(table_name, total_rows)
> );
A rule would be much easier:
CREATE RULE rule_name AS ON INSERT TO zzz DO
<Write an update of total_rows query here>;
--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mmarques@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------