X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66BBB8B9B85 for ; Mon, 21 Feb 2005 18:47:59 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82217-05 for ; Mon, 21 Feb 2005 18:47:48 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0E4778B9B4D for ; Mon, 21 Feb 2005 18:47:48 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id CFB0531FEF; Mon, 21 Feb 2005 19:47:47 +0100 (MET) From: "Nico" X-Newsgroups: pgsql.interfaces.jdbc Subject: Re: making a rule and know when it is violated Date: Mon, 21 Feb 2005 19:45:49 +0100 Organization: Hub.Org Networking Services Lines: 35 Message-ID: References: <87acpxlwkx.fsf@meuh.mnc.ch> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-jdbc@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.312 tagged_above=0 required=5 tests=AWL, FORGED_YAHOO_RCVD, PRIORITY_NO_NAME X-Spam-Level: *** X-Archive-Number: 200502/144 X-Sequence-Number: 12324 I don't know how to write it in postgresql. "Guillaume Cottenceau" schreef in bericht news:87acpxlwkx.fsf@meuh.mnc.ch... > "Nico" writes: > >> Hello, >> I want to make a rule in phpPgAdmin(PostgreSQL 7.3.8-RH ). >> Then I want to intercept any violation on that rule in java. >> Here is the table creation code: >> CREATE TABLE "tblUser" ( >> "UserID" serial NOT NULL, >> "UserName" character varying(50) NOT NULL, >> "UserPass" character varying(50) NOT NULL, >> "UserRoleID" integer DEFAULT 3 NOT NULL >> ); >> Now it's imperative that the field UserRoleID has maximum one record that >> contains the integer 1. Possible other values are 2 and 3. They are >> allowed >> to exist in more than one record. >> After that I need to know in java how to know when a violation of this >> rule >> occurs. > > Why not using a trigger function in postgres? > > -- > Guillaume Cottenceau > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >