 CREATE TABLE TAGS(
 	art INTEGER REFERENCES ARTICLE(id),
 	word VARCHAR(100),
+	modi CHAR(7) REFERENCES TUSER(login),
 	PRIMARY KEY(art,word)
 );
 

--------L'HISTORIQUE DE LIAISON ENTRE RUBRIQUES ET ARTICLES
CREATE OR REPLACE FUNCTION process_tr_historique_article5() RETURNS TRIGGER AS $tr_historique_article5$
    BEGIN
		INSERT INTO HISTORIQUE_ARTICLE(id, art, aDate, login, aAction ) VALUES (nextval('idauto_his_art'), NEW.art ,current_timestamp,'$currentLogin','lier_rubrique');
		RETURN NULL; 
    END;
$tr_historique_article5$ LANGUAGE plpgsql VOLATILE;

CREATE TABLE TIE_ARTICLE(
	firstArticle INTEGER REFERENCES ARTICLE(id),
	secondArticle INTEGER REFERENCES ARTICLE(id),
	modi CHAR(7) REFERENCES TUSER(login),
	CHECK(firstArticle!=secondArticle),
	UNIQUE(secondArticle,firstArticle), --(1,2) et (2,1) sont pareils
	PRIMARY KEY(firstArticle, secondArticle)
