|
|
Bug in postgres driver quotation |
Query page
Enter new bug
Class PostgreSQLFactory has invalid quoteName method. You can't use
any databse schema with it. So driver works only with databases
without schemas. Correct quotation should looks like.
public String quoteName( String name )
{
int index;
index = name.indexOf('.');
if (index > 0) {
String result = "";
int tmpIndex = 0;
while (index > 0) {
result += name.substring(tmpIndex, index) + "\".\"";
tmpIndex = index + 1;
index = name.indexOf('.', tmpIndex);
}
return '"' + result + name.substring(tmpIndex) + '"';
}
return '"' + name + '"';
}
------- Additional Comment
#1 From
Martin Fuchs
2004-11-05 13:42 -------
Yes, the current PostgreSQLFactory.quoteName() function is not sufficent to
quote names with the three components schema name, table name and column name.
It should instead call the generic function genericFactory.doubleQuoteName()
like OracleFactory.quoteName() and SybaseFactor.quoteName():
public String quoteName( String name )
{
return doubleQuoteName( name );
}
------- Additional Comment
#2 From
Werner Guttmann
2004-11-28 11:16 -------
Created an attachment (id=791)
Initial patch based upon above comments.
I'd really appreciate if somebody familiar with postgreSQL could let us know
whether using schemes works as a result of this patch.
------- Additional Comment
#3 From
Pawel Pesz
2004-12-03 00:52 -------
I haven't actually tested the patch but the code in
GeneralFactory.doubleQuoteName looks fine to me. I'm a former co-worker of the
original submitter :-)
------- Additional Comment
#4 From
Werner Guttmann
2004-12-03 02:15 -------
Pawel, would downloading the latest sources (from CVS), applying the patch,
building Castor and verifying whether it resolves the problem be an option for you ?
------- Additional Comment
#5 From
Werner Guttmann
2004-12-03 02:15 -------
More generally, can somebody please post a test case (incl. mapping file et
alias) that coudl be used to verify that things work ?
------- Additional Comment
#6 From
Pawel Pesz
2004-12-03 04:19 -------
All right, I'll try and do that. A test case should not be hard to come up with
but unfortunately I can't promise you I'll manage to find time to prepare it.
------- Additional Comment
#7 From
Werner Guttmann
2004-12-03 07:49 -------
If you wanted, I could send you a couple of files that I normally use to write a
test case, i.e.
- a mapping file.
- a JDO config file
- A JUnit test case with at least one testXXX() method.
- a SQL DDL file.
Let me know whether this would be of any use to you.
------- Additional Comment
#8 From
Pawel Pesz
2004-12-06 00:47 -------
Yes, it certainly will. I would really appreciate it.
------- Additional Comment
#9 From
Pawel Pesz
2004-12-07 08:24 -------
OK. I conducted tests on my code-base which includes 50+ classes and tables. All
table definitions use PostgreSQL schemas. The patch works for me just fine.
------- Additional Comment
#10 From
Pawel Pesz
2004-12-09 01:37 -------
I just sent a test case to Werner, based on his code. Thanks :-)
------- Additional Comment
#11 From
Werner Guttmann
2004-12-09 02:31 -------
Patch applied as it. Will add test case anywhen later (but before 0.9.6 releae).
Query page
Enter new bug
This is Bugzilla: the Mozilla bug system. For more
information about what Bugzilla is and what it can do, see
bugzilla.org.
|
|