Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 9CB0147722E for ; Thu, 13 Jun 2002 17:21:51 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id DB051476F75 for ; Thu, 13 Jun 2002 16:59:15 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 588A1D600; Thu, 13 Jun 2002 13:59:17 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 4E42C5C01; Thu, 13 Jun 2002 13:59:17 -0700 (PDT) Date: Thu, 13 Jun 2002 13:59:17 -0700 (PDT) From: Stephan Szabo To: Tim Ellis Cc: Subject: Re: Triggers... Questions... Yes. In-Reply-To: <20020613124835.6e182cd4.Tim.Ellis@gamet.com> Message-ID: <20020613134729.F7376-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200206/92 X-Sequence-Number: 4527 On Thu, 13 Jun 2002, Tim Ellis wrote: > I just used Dezign for Databases and created a simple table in what it > claimed was "ANSI Level 2" compliance with a one-up "autonum" column. > > It spewed forth the following code: > > -- file generated by "dezign for databases" > -- create-date :6/13/2002 > -- create-time :10:29:56 am > -- project-name :not yet specified > -- project-author :not yet specified > > create table transaction(autonum integer); > > create trigger transaction_autonum_inc > before insert on transaction > referencing new as n > for each row > set (n.autonum) = (select (max(autonum),0) + 1 from transaction); > > Postgres (as you might suspect) didn't like it. Looking at the Postgres > "create trigger" syntax, there is nothing about "referencing X as Y" being > a possible phrase. > > Is the problem in: > > 1. Dezign for Databases, this really isn't ANSI Level 2, > 2. Postgres, it doesn't (yet) support this level of functionality, but > should, or > 3. Me, I'm mixing up ANSI Level 2 and ANSI SQL '92, Postgres doesn't now > and has no plans to support ANSI Level 2 SQL IIRC, SQL92 doesn't have triggers. I believe the above is SQL 99 syntax and it looks like triggers aren't Core SQL99 either. PostgreSQL may eventually take the full SQL99 syntax but it's likely to be a while unless someone wants it enough to work on it.