Received: from mail2.panix.com (mail2.panix.com [166.84.0.213]) by hub.org (8.9.1/8.9.1) with ESMTP id KAA09635 for ; Sun, 15 Nov 1998 10:08:46 -0500 (EST) (envelope-from tomg@admin.nrnet.org) Received: from mailhost.nrnet.org (root@mailhost.nrnet.org [166.84.192.39]) by mail2.panix.com (8.8.8/8.8.8/PanixM1.3) with ESMTP id KAA24027; Sun, 15 Nov 1998 10:08:42 -0500 (EST) Received: from admin.nrnet.org (uucp@localhost) by mailhost.nrnet.org (8.8.7/8.8.4) with UUCP id KAA16092; Sun, 15 Nov 1998 10:09:01 -0500 Received: from localhost (tomg@localhost) by admin.nrnet.org (8.8.7/8.8.7) with SMTP id KAA08704; Sun, 15 Nov 1998 10:08:40 -0500 Date: Sun, 15 Nov 1998 10:08:40 -0500 (EST) From: Thomas Good To: Marc Howard Zuckman cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] abusing an aggregate funct In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sat, 14 Nov 1998, Marc Howard Zuckman wrote: > Use a sequence to generate rec_num. See man create_sequence. Got it. Thanks Marc! > You can then use curval('sequence_name') to get the last > sequence number generated, or if you are performing an insert: > insert into crtrd1 (p_key,otherdata) values (nextval('sequence_name',moredata); > > You could also create the table using nextval as the default > value of p_key. You may wish to create a unique_index on > p_key, but nextval is guaranteed not to generate duplicates > unless you allow it to rollover. > > > > > > Marc Zuckman > marc@fallon.classyad.com > > _\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ > _ Visit The Home and Condo MarketPlace _ > _ http://www.ClassyAd.com _ > _ _ > _ FREE basic property listings/advertisements and searches. _ > _ _ > _ Try our premium, yet inexpensive services for a real _ > _ selling or buying edge! _ > _\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ > ---------- Sisters of Charity Medical Center ---------- Department of Psychiatry ---- Thomas Good Coordinator, North Richmond C.M.H.C. Information Systems 75 Vanderbilt Ave, Quarters 8 Phone: 718-354-5528 Staten Island, NY 10304 Fax: 718-354-5056