Bug 267343 - Cannot override default schema for PostgreSQL
Summary: Cannot override default schema for PostgreSQL
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 2.1.1   Edit
Hardware: PC Windows Vista
: P1 major (vote)
Target Milestone: 2.2 RC3   Edit
Assignee: Brian Vosburgh CLA
QA Contact:
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks: 276768
  Show dependency tree
 
Reported: 2009-03-06 05:50 EST by Juergen Zimmermann CLA
Modified: 2009-06-26 13:17 EDT (History)
5 users (show)

See Also:
david_williams: pmc_approved+
neil.hauge: pmc_approved? (raghunathan.srinivasan)
neil.hauge: pmc_approved? (naci.dai)
deboer: pmc_approved+
neil.hauge: pmc_approved? (neil.hauge)
neil.hauge: pmc_approved? (kaloyan)
neil.hauge: review+


Attachments
Screenshot for PostgreSQL when trying to override default schema (51.42 KB, image/pjpeg)
2009-03-06 05:52 EST, Juergen Zimmermann CLA
no flags Details
Screenshot of Data Source Explorer (51.80 KB, image/pjpeg)
2009-03-25 06:06 EDT, Juergen Zimmermann CLA
no flags Details
candidate patch (84.84 KB, patch)
2009-05-25 15:27 EDT, Brian Vosburgh CLA
no flags Details | Diff
reduced patch (61.63 KB, patch)
2009-05-26 09:57 EDT, Brian Vosburgh CLA
no flags Details | Diff
amended patch (62.17 KB, patch)
2009-05-26 13:39 EDT, Brian Vosburgh CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Zimmermann CLA 2009-03-06 05:50:28 EST
When creating a JPA project the wizard doesn't provide the possibility to override the default schema for PostgreSQL. This problem doesn't exist when using the Dali shipped with WTP 3.0.4.

A screenshot will be provided.
Comment 1 Juergen Zimmermann CLA 2009-03-06 05:52:06 EST
Created attachment 127795 [details]
Screenshot for PostgreSQL when trying to override default schema
Comment 2 Neil Hauge CLA 2009-03-19 16:30:35 EDT
Do you see any exceptions in the error log that appear to be related?
Comment 3 Juergen Zimmermann CLA 2009-03-25 06:06:03 EDT
Created attachment 129817 [details]
Screenshot of Data Source Explorer

Sorry, there is no entry in .metadata/.log

Perhaps it might help to see the screenshot of the "Data Source Explorer" to see that there are 2 schemas: jpublic (being the default schema in PostgreSQL) and "hskaspring" (this is the schema I have to use).
Comment 4 Jason Kusnier CLA 2009-04-27 15:57:43 EDT
I too am having this problem with Dali and PostgreSQL.  Same issue, and no error in the log.
Comment 5 Juergen Zimmermann CLA 2009-05-13 01:25:20 EDT
Is a fix for this problem included in WTP 3.1 M7 ?
Comment 6 Neil Hauge CLA 2009-05-13 11:31:15 EDT
We have added a Catalog Override in M7, which should allow you to set the appropriate catalog for your DB and then should allow you to pick a Schema Override.  Give this a try and let me know of the outcome.
Comment 7 Juergen Zimmermann CLA 2009-05-19 11:56:07 EDT
I tried Eclipse 3.5RC1 and WTP 3.1M7:

1) Catalog: offers the existing database to be selected
2) Schema: is still empty when trying to override the default schema
Comment 8 Neil Hauge CLA 2009-05-25 10:21:34 EDT
Upgrading severity based on comment #7.  This bug prevents some users from using DB metadata in Dali, which limits at least 50% of our functionality.
Comment 9 Brian Vosburgh CLA 2009-05-25 15:27:57 EDT
Created attachment 137063 [details]
candidate patch

This patch attempts to at least make the catalog and schema settings available and related to each other; but the desired behavior (esp. with the properties page) is not perfectly clear....
Comment 10 Brian Vosburgh CLA 2009-05-26 09:57:28 EDT
Created attachment 137153 [details]
reduced patch

Removed some unnecessary changes.

Current changes:

GenericJpaModel
- initialized JPA project config with user override catalog

JpaProjectPropertiesPage
- added connection between schema choices and selected catalog
- refactored catalog and schema code to reduce duplicate code

JpaFacetDataModelProvider
- added connection between schema choices and selected catalog
- cleaned up lots of sloppy code to make debugging easier
Comment 11 Brian Vosburgh CLA 2009-05-26 13:39:35 EDT
Created attachment 137200 [details]
amended patch

Amended patch to fix some of the flakiness that occurs when switching among different 'Connections' (e.g. if the 'Override default schema...' check box were checked when changing the 'Connection', the associated combo selection would be cleared; but there would be no error message indicating a schema needed to be selected).
Comment 12 Neil Hauge CLA 2009-05-26 15:51:36 EDT
(In reply to comment #11)

> Amended patch to fix some of the flakiness that occurs when switching among
> different 'Connections' (e.g. if the 'Override default schema...' check box
> were checked when changing the 'Connection', the associated combo selection
> would be cleared; but there would be no error message indicating a schema
> needed to be selected).
> 

What is the expected behavior as a result of this change?
Comment 13 Brian Vosburgh CLA 2009-05-26 16:35:14 EDT
(In reply to comment #12)
> (In reply to comment #11)
> 
> > Amended patch to fix some of the flakiness that occurs when switching among
> > different 'Connections' (e.g. if the 'Override default schema...' check box
> > were checked when changing the 'Connection', the associated combo selection
> > would be cleared; but there would be no error message indicating a schema
> > needed to be selected).
> > 
> 
> What is the expected behavior as a result of this change?
> 

An error message saying something like "An override schema is not selected".
Comment 14 Karen Butzke CLA 2009-05-26 17:54:58 EDT
I have tested with a derby database just to verify that existing use cases were not broken.  This included testing the DDL generation, entity generation, connecting/disconnecting, deleting a connection, overriding the schema via the project properties as well as the new project wizard.  There don't appear to be any regressions with this patch, things look good to me.
Comment 15 Neil Hauge CLA 2009-05-26 23:46:27 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug"
(requested by an adopter) please document it as such. 
This bug causes a major loss of functionality for users with certain configurations where the default table qualification cannot be calculated by Dali.  This is a regression in functionality from Ganymede.  It is currently known to affect users of the PostgreSQL and MS SQL Server DB's.  This bug would also fix the issue in bug 276768.

* Is there a work-around? If so, why do you believe the work-around is
insufficient? 
There is no workaround for this problem.  Dali DB related functionality will not work for these cases.

* How has the fix been tested? Is there a test case attached to the bugzilla
record? Has a JUnit Test been added? 
This fix has been thoroughly tested by Brian, Karen, and myself today to ensure that there are no regressions from current functionality.  The new behavior to support this case has also be tested.

* Give a brief technical overview. Who has reviewed this fix? 
See comment #10.  This is a fairly extensive change, but it is isolated to 3 internal classes and 2 specific areas of functionality (new project creation and project properties), which in this case well isolates the fix, as well as the test cases needed to insure full test coverage.  I have reviewed the code changes.

* What is the risk associated with this fix?
Risk is moderate, but well mitigated due to the amount of testing performed on this change.  Due to the fact that the fix is isolated and the testing has been thorough, in addition to the severity of this bug, I think the change meets the criteria to be fixed in the next release candidate.  I would like to get the change in at the beginning of this RC cycle so we can get the community testing early as well to insure that this problem has been corrected.
Comment 16 Tim deBoer CLA 2009-05-27 09:23:38 EDT
Definitely a large patch for this point in the release, but code doesn't look like it will affect adopters, solves an ugly problem, and testing/regressions passed. Approved.
Comment 17 Brian Vosburgh CLA 2009-05-27 14:13:59 EDT
Last patch checked into HEAD.
Comment 18 Juergen Zimmermann CLA 2009-06-08 13:07:30 EDT
I just tested WTP 3.1 RC3 using PostgreSQL 8.4.beta2, and it works fine.
Comment 19 Jason Kusnier CLA 2009-06-17 14:23:28 EDT
I am still seeing an issue with this if my database has a - (hyphen) in the name.  When I rename the db and remove the - (hyphen) it works fine.  Maybe an escaping issue when connecting to the db?
Comment 20 Brian Vosburgh CLA 2009-06-25 14:48:10 EDT
(In reply to comment #19)
> I am still seeing an issue with this if my database has a - (hyphen) in the
> name.  When I rename the db and remove the - (hyphen) it works fine.  Maybe an
> escaping issue when connecting to the db?
> 

I could not replicate this problem. If I do the following:

  - build a PostgreSQL server with a database named "test-db"
  - build a DTP connection configured to use that database
  - start the New JPA Project wizard
  - select the DTP connection built above

The "Catalog:" drop-down below the "Override default catalog from connection" check-box contains a delimited entry for the database:
  "test-db"

Could you give a detailed description of the steps you took to see this problem?
Comment 21 Brian Vosburgh CLA 2009-06-25 14:52:19 EDT
[continuing comment 20]
... and the "Schema:" drop-down below the "Override default schema from connection" check-box contains a list of database's schemata:
  information_schema
  pg_catalog
  pg_toast_temp_1
  public
  
Comment 22 Jason Kusnier CLA 2009-06-25 14:55:23 EDT
My database name is all uppercase, not sure if that matters.  TEST-DB
Comment 23 Brian Vosburgh CLA 2009-06-26 13:17:43 EDT
(In reply to comment #22)
> My database name is all uppercase, not sure if that matters.  TEST-DB

That changes things a bit. The dialog does not correctly detect an all-caps name as the default. (I will fix this.) But that does not prevent me from selecting the catalog with the same name and the schema drop-down from being populated with the list of schemata in that catalog/database.