Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 81390 invoked from network); 12 Sep 2004 14:23:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 12 Sep 2004 14:23:41 -0000 Received: (qmail 24072 invoked by uid 500); 12 Sep 2004 14:23:40 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 24042 invoked by uid 500); 12 Sep 2004 14:23:39 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 24029 invoked by uid 99); 12 Sep 2004 14:23:39 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [203.202.1.123] (HELO barge.anchor.net.au) (203.202.1.123) by apache.org (qpsmtpd/0.28) with ESMTP; Sun, 12 Sep 2004 07:23:36 -0700 Received: from [192.168.0.2] (CPE-61-9-201-26.nsw.bigpond.net.au [61.9.201.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by barge.anchor.net.au (Postfix) with ESMTP id 962DF10056 for ; Mon, 13 Sep 2004 00:23:32 +1000 (EST) Message-ID: <41445BE0.5040306@backstagetech.com.au> Date: Mon, 13 Sep 2004 00:23:28 +1000 From: Scott Eade User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Apache Torque Developers List Subject: Re: PostgreSQL ID generation References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N [Delayed response - several reasons...] Henning P. Schmiedehausen wrote: >... must think some more. > A few things strike me: 1. The schema reference (included in the Generator section of the Torque site) is by no means complete and is scant on detail given how important it is in the scheme of things (no pun intended). This document should provide a decent specification of the effect the various elements and attributes will have on the generated sql and OM code rather than being a partial reference used to assist with a trial and error decoding process. 2. PostgreSQL has a serial data type that Torque already supports to a limited extent. IMHO we should fully embrace this by: 1. Generating schema sql that used the SERIAL datatype rather than "default nextval('foo_bar_seq')" (the latter with a different sequence name structure is what PostgreSQL maintains automatically when the SERIAL datatype is used). 2. Leaving sequence naming (with the available override), sequence creation and destruction (drop) to PostgreSQL. 3. Enhancing the JDBC target to detect the use of sequences so as to produce schema files that use SERIAL. 4. Determine whether or not the id-method-parameter element has any use. 3. The column elements autoIncrement attribute in the schema is not clearly defined. Correct me if I am wrong, but from your comments and your patch it appears that you interpret a combination of idMethod="native" for the table and autoIncrement="true" on a column to be the triggers for the use of a sequence. I actually thought that primaryKey="true" had something to do with it and from the generated code this does in fact appear to be the case. Generate the sql for the following schema (comments on the resultant sql are included within):
We could update Torque to consistently use the SERIAL datatype, and to only so this when autoIncrement is true. In addition to this it would be great if we could provide a means of specifying the sequence name for the particular column it is use on, perhaps seqName should be a column attribute (and perhaps an option to determine whether or not the sequence should be created and dropped would help out people with existing sequences). Basically as it stands it is a right mess and needs to be addressed before the next RC. Scott -- Scott Eade Backstage Technologies Pty. Ltd. http://www.backstagetech.com.au --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org