agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Quandt Brian <quandt@eec.umr.edu>
To: postgres@postgres.Berkeley.EDU
Subject: Rewrite rule question (or is it something else)?
Date: Mon, 18 Jul 1994 21:11:02 -0500 (CDT)
Message-ID: <199407190211.VAA03097@umrgec8.eec.umr.edu> (raw)

 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.
==============================================================================



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: quandt@eec.umr.edu
  Subject: Re: Rewrite rule question (or is it something else)?
  In-Reply-To: <199407190211.VAA03097@umrgec8.eec.umr.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox