Return-Path: owner-postman Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id TAA14543 for postgres-redist; Mon, 18 Jul 1994 19:13:30 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199407190213.TAA14543@nobozo.CS.Berkeley.EDU> X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from umr.edu ([131.151.1.68]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with ESMTP id TAA14533 for ; Mon, 18 Jul 1994 19:13:29 -0700 Received: from eec.umr.edu (umrgec7.eec.umr.edu [192.65.97.43]) via SMTP by hermes.cc.umr.edu (8.6.9/E.3.01) id VAA02940; Mon, 18 Jul 1994 21:12:05 -0500 Received: from umrgec8.eec.umr.edu (umrgec8.eec.umr.edu [192.65.97.44]) via ESMTP by umrgec7.eec.umr.edu (8.6.9/D.3.00) id VAA02713; Mon, 18 Jul 1994 21:20:18 -0500 From: Quandt Brian Received: from (quandt@localhost) by umrgec8.eec.umr.edu (8.6.9/M.3.01) id VAA03097; Mon, 18 Jul 1994 21:11:04 -0500 Message-Id: <199407190211.VAA03097@umrgec8.eec.umr.edu> Subject: Rewrite rule question (or is it something else)? To: postgres@postgres.Berkeley.EDU Date: Mon, 18 Jul 1994 21:11:02 -0500 (CDT) X-Mailer: ELM [version 2.4 PL21] Content-Type: text Content-Length: 995 Resent-To: postgres-redist@postgres.Berkeley.EDU Resent-Date: Mon, 18 Jul 94 19:13:30 -0700 Resent-XMts: smtp I posted this question to comp.databases. Maybe there is someone in this list that can help me. > > Here's my question. > > I have a record/class of the following form > > create blah (name=text, phone=int4,..., id=int4) \g > > I'd like postgres to automatically fill in the "id" field by looking > up the largest previous one and adding "1" to it. I believe the > easiest way to do this is via a "define rewrite rule". However, > this causes a problem in that this is a cyclic reference. I thought >about creating shadow records. That is when a user updates the >front record, a rewrite rule will really update the shawdow record, >then any special rules could be imbedded at this point,ie many >rewrite rules of the following would be created > >define rewrite rule is on append ... rec1 >do instead append rec2 > >But the syntax does not allow me to do this (parse errors). > >Am I missing something here. Is there a better way to do this? Must >be. > > Brian Quandt > ============================================================================== To add/remove yourself to/from the POSTGRES mailing list: send mail with the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU" If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and a human will deal with it. DO NOT post to the "postgres" mailing list. ==============================================================================