Menu

#248 Postgresql and schema

v2.3.*
open
nobody
None
5
2014-04-20
2009-06-11
cwo
No

I have different schemas on Postgresql 8.3 using the latest dbunit-2.4.5. I cannot delete table entries by DatabaseOperation.DELETE_ALL.execute(...)

IDatabaseConnection contains the schema (in this case BI, but it does taken into account)

The problem is:
In the DatabaseOperation.DELETE_ALL

a) I put in a table with name: schema.tablename: BI.APP_ROLE_ALL_CHILDREN
-> org.dbunit.dataset.NoSuchTableException: BI.APP_ROLE_ALL_CHILDREN
-> Table 'BI.APP_ROLE_ALL_CHILDREN' not found in tableMap==org.dbunit.dataset.OrderedTableNameMap[_tableNames=[app_role_all_children, ...]

So the check does not take the schema into account.

b) I put in a table without a schema: tablename: APP_ROLE_ALL_CHILDREN
-> postgres likes to execute this sql: select * from APP_ROLE_ALL_CHILDREN without the schema which throws an:
org.postgresql.util.PSQLException: Error Relation »app_role_all_children« does not exist

Which is right as well, because the sql should be: select * from BI.APP_ROLE_ALL_CHILDREN

So both ways don't work. I expected a behavior that takes the given schema in the IDatabaseConnection into account so that I can put in the (same) schema or leave it away. None of these both cases above should generate an exception.

Discussion

  • matthias g

    matthias g - 2009-06-11

    Did you try to set the feature DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES and/or DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES? Your first case sounds as if the case is not correct.

     
  • cwo

    cwo - 2009-06-12

    I checked with lower case as well, but it did not work. The table is found if I remove the schema from the table name even if the case is toUpper. I'll have to check if DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES will help.

     
  • matthias g

    matthias g - 2009-09-23

    Hi cwo,
    could you please let me know whether your problem is solved?
    thanks,
    matthias