Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 113309FB3A5 for ; Tue, 31 Oct 2006 14:48:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 59155-10 for ; Tue, 31 Oct 2006 14:48:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by postgresql.org (Postfix) with ESMTP id 348A39FB1F5 for ; Tue, 31 Oct 2006 14:48:46 -0400 (AST) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1GeyfE1A98-0007Xk; Tue, 31 Oct 2006 19:48:44 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1GeyfD-0003Kl-00 for pgsql-sql@postgresql.org; Tue, 31 Oct 2006 19:48:43 +0100 Date: Tue, 31 Oct 2006 19:48:43 +0100 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: Table Relationships Message-ID: <20061031184843.GA12767@a-kretschmer.de> References: <031936836C46D611BB1B00508BE7345D04C02E82@gatekeeper.daycos.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <031936836C46D611BB1B00508BE7345D04C02E82@gatekeeper.daycos.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200610/249 X-Sequence-Number: 26638 am Tue, dem 31.10.2006, um 11:15:26 -0600 mailte Curtis Scheer folgendes: > Given the following two tables: > > CREATE TABLE public.task > ( > taskid int4 NOT NULL DEFAULT nextval('task_taskid_seq'::regclass), > description varchar, > CONSTRAINT pk_taskid PRIMARY KEY (taskid) > ) > > public.users > ( > userid int4 NOT NULL, > username varchar, > CONSTRAINT pk_userid PRIMARY KEY (userid) > ) > > I want to record which user ?performed the task? and which user ?checked the > task?, I?ve come up with a few ideas on this but I would like to know what the > correct way would be to implement this into my table design. Perhaps a table like this: ( user int references public.users, task int references public.task, ts timestamptz default now(), action char(1) check (action in ('p','c')) ) -- with p(perform), c(cheked) HTH, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net