You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by to...@db.apache.org on 2004/03/25 23:23:33 UTC

[DB Torque Wiki] Updated: PostgreSQLFAQ

   Date: 2004-03-25T14:23:31
   Editor: 128.200.36.28 <>
   Wiki: DB Torque Wiki
   Page: PostgreSQLFAQ
   URL: http://wiki.apache.org/db-torque/PostgreSQLFAQ

   more on SERIAL (aka autoincrement in mysql)

Change Log:

------------------------------------------------------------------------------
@@ -61,6 +61,15 @@
 
 To get sequences to work I added the <id-method-parameter> elements mentioned above, but then had to remove the sql that drops/creates the sequences that was generated by torque:sql before executing it with torque:insert-sql. -- ScottEade 2003-10-14
 
+There might be another way to handle sequences for wiser heads to figure out.  Using {{{maven torque:jdbc}}} with Postgresql 7.4.1-jdbc3, my SERIAL columns were converted to XML as follows {{{
+       <table name="company">
+        <column default="nextval('public.company_id_seq'::text)"
+            name="id" primaryKey="true" required="true" type="INTEGER"/>
+        ...
+}}}  
+
+While there are lots of problems with that snippet (such as the fact that the java produced by subsequent the {{{maven torque:om}}} goal is buggy), perhaps this could be recognized as calling the Postgresql internal function nextval [http://www.postgresql.org/docs/7.4/interactive/functions-sequence.html Postgresql--Sequence-Manipulation Functions], and somehow link that with the ability to define such calls in java, as in [http://www.postgresql.org/docs/7.4/interactive/jdbc-callproc.html Postgresql--Calling Stored Functions].  Grepping the source tree, I saw calls to nextval in the Oracle driver, but I didn't explore further.  Perhaps this code is similar?
+
 = Do I need to patch the PostgreSQL driver to work with Torque? =
 
 You do not need to apply any patches to the Postgres driver in order to use Torque <strong>unless</strong>

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org