Date: 2004-04-21T17:37:35
   Editor: ScottEade <[EMAIL PROTECTED]>
   Wiki: DB Torque Wiki
   Page: PostgreSQLFAQ
   URL: http://wiki.apache.org/db-torque/PostgreSQLFAQ

   Added table of contents.

Change Log:

------------------------------------------------------------------------------
@@ -1,8 +1,10 @@
-= Can I use Torque with PostgreSQL =
+[[TableOfContents]]
+
+== Can I use Torque with PostgreSQL ==
 
 Yes, it would appear that several people are using Torque and PostgreSQL together 
successfully.  You do however need to be aware of the issues outlined in the rest of 
this FAQ.
 
-= I have problems using idMethod='native'.  What's up? =
+== I have problems using idMethod='native'.  What's up? ==
 
 PostgreSQL creates a sequence with a special name for the autoincrement.  In order to 
get Torque to interact gracefully with this sequence, you need to tell it the sequence 
name.  In addition, Postgres restricts the sequence name to 30 characters, which means 
that the names get truncated strangely.  Thus, to get everything to work, you 
basically need to do the following:
  1. include a <id-method-parameter name="seqName" value="Tablename_columnname_seq"/> 
in every table that has an "autoincrement" column.
@@ -70,7 +72,7 @@
 
 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? =
+== 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>
 you want to use "large objects" (CLOBS/BLOBS).   
@@ -79,7 +81,7 @@
 of user information directly in the database.  This data was stored as a BLOB.  
 Now that Torque is decoupled from Turbine, this issue is only relevant if you use 
BLOBs into your schema (ie, use the datatypes BLOB or CLOB or LONGVARBINARY or 
LONGVARCHAR).
 
-= So what if I am using BLOBS, etc. ? =
+== So what if I am using BLOBS, etc. ? ==
 
  1.  You will need to patch the driver.
  1.  The JDBC "BLOB" type should map to the PostgreSQL "oid" column type, but the 
JDBC driver does not support this automatically. The JDBC driver returns metadata that 
indicates that "oid" columns have JDBC type Types.INTEGER (the type of the oid ID 
pointer itself), so Torque (actually, the underlying Village API) doesn't treat the 
column properly. This can be fixed by patching the JDBC driver, as mentioned in the 
[http://db.apache.org/torque/postgres-howto.html PostgreSQL Howto]. 
@@ -87,7 +89,7 @@
 
 This http://db.apache.org/torque/postgres-howto.html seems out of date since the 
Field.java file has none of the code indicated. A recent, or better fix is where? --rnh
 
-= What other issues are there? =
+== What other issues are there? ==
 
  *  Three patch issues in Scarab (quoting various values) 
[http://nagoya.apache.org/scarab/issues/id/TRQS109 
TRQS109][http://nagoya.apache.org/scarab/issues/id/TRQS110 
TRQS110][http://nagoya.apache.org/scarab/issues/id/TRQS111 TRQS111] - that these 
patches need to be applied in order to use PostgreSQL not totally clear (existing test 
cases all pass). (If someone can confirm that these are required, or better still 
provide test cases, I will commit them. -- ScottEade 2003-02-05)
  *  Bill Schneider mentioned on torque-user that "serial" columns are by defaul 
defined to be of type int4 and that this could pose a problem (the comment may have 
been made prior to Torque switching from BigDecimal to int for object keys).  Note 
that int4 corresponds to Java int, so this will only be an issue if you need to 
support a larger range of values than int provides.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to