Ingres Dialect is using the MultiTableBulkIdStrategy of GlobalTemporaryTableBulkIdStrategy.
Unfortunately unlike Oracle, Ingres doesn't support multiple sessions accessing a global temporary table (it is per session, odd i know!).
Current Implementation {code:java} @Override public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() { return new GlobalTemporaryTableBulkIdStrategy( new IdTableSupportStandardImpl() { @Override public String generateIdTableName(String baseName) { return "session." + super.generateIdTableName( baseName ); }
@Override public String getCreateIdTableCommand() { return "declare global temporary table"; }
@Override public String getCreateIdTableStatementOptions() { return "on commit preserve rows with norecovery"; } }, AfterUseAction.CLEAN ); } {code}
Possible Improved Implementation (that actually works!), to fix this we need to implement our own dialect and override the default multi table bulk id strategy.
{code:java} @Override public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() { return new LocalTemporaryTableBulkIdStrategy( new IdTableSupportStandardImpl() { @Override public String generateIdTableName(String baseName) { return "session." + super.generateIdTableName( baseName ); } @Override public String getCreateIdTableCommand() { return "declare global temporary table"; } @Override public String getCreateIdTableStatementOptions() { return "on commit preserve rows with norecovery"; }
@Override public String getDropIdTableCommand() { return "drop table"; } }, AfterUseAction.DROP, null ); } {code}
Using the original implementation results in an sql exception
{noformat} Caused by: java.sql.SQLSyntaxErrorException: Table 'HT_lr_batch_run' does not exist or is not owned by you. {noformat}
I can create a pull request if you'd like.. Do you have an Ingres DB to run test against? or should I just skip implementing a test case?
{panel:title=Ingres Declare Global Definition} The DECLARE GLOBAL TEMPORARY TABLE statement creates a temporary table, also referred to as a session-scope table. Temporary tables are useful in applications that need to manipulate intermediate results and want to minimize the processing overhead associated with creating tables. Temporary tables have the following characteristics: Temporary tables are visible only to the session that created them. Temporary tables are deleted when the session ends (unless deleted explicitly by the session). They do not persist beyond the duration of the session. Temporary tables can be created, deleted, and modified during an online checkpoint. If the LOCATION parameter is omitted, the temporary table is located on the default database location (if the temporary table requires disk space). If the subselect is omitted, the temporary table is created as a heap. If the LOCATION parameter is included, its value can be ii_database or the name of an alternate location that has been previously created and marked as a work location. When a transaction is rolled back, any temporary table that was in the process of being updated is dropped (because the normal logging and recovery processes are not used for temporary tables).
{panel}
|
|