Subject: Rewrite rule question (or is it something else)?

From: Quandt Brian <[email-masked]>
Date: Mon, 18 Jul 1994 21:11:02 -0500 (CDT)

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 "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================