Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 225079 - SQLIdentifiers.Quoter does not correctly quote identifiers containing the quote character itself
SQLIdentifiers.Quoter does not correctly quote identifiers containing the quo...
Product: db
Classification: Unclassified
Component: Code
: P3 (vote)
: 7.4
Assigned To: Jaroslav Havlin
Depends on:
  Show dependency treegraph
Reported: 2013-01-18 23:14 UTC by ebakke
Modified: 2013-02-10 01:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT

proposed patch v1 part 1 (2.83 KB, patch)
2013-01-19 21:04 UTC, matthias42
Details | Diff
proposed patch v1 part 2 (3.38 KB, patch)
2013-01-19 21:12 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ebakke 2013-01-18 23:14:12 UTC
The default implementation of does not correctly quote/unquote identifiers that contains the quote string itself. The correct way to do quote the quote string is, as far as I know, to include it twice (at least for MySQL and Postgres--I just tried it).

For instance, in MySQL, the quote string is "`" (a single backtick character), and so a table named "Table with `Backticks` and Spaces" should be quoted as "`Table with ``Backticks`` and Spaces`".

The bug can be exhibited for instance by creating a table in MySQL with a name containing a backtick character, then connecting to the database from NetBeans, and then clicking "View Data..." on the table to see the generated query with the incorrect quoting.

The methods that need updating are Quoter.doQuote(), Quoter.unquote(), and probably DatabaseMetaDataQuoter.needToQuote() (the latter to ensure that the identifier does not contain the quote string).

(As an aside: I wonder if there are databases out there that quote the quote character differently...)
Comment 1 matthias42 2013-01-19 21:04:26 UTC
Created attachment 130405 [details]
proposed patch v1 part 1

The diagnosis is correct and reproducible. The first attached patch fixes this and adds a unit-test for this.
Comment 2 matthias42 2013-01-19 21:12:09 UTC
Created attachment 130406 [details]
proposed patch v1 part 2

Part 2 of the patch - the lexer did not correctly worked with identifier quoting characters other than ". The patch includes a modified unit-test.
Comment 3 ebakke 2013-01-20 18:19:20 UTC
Thanks--I'm impressed by the swift response :-)

(I take back my earlier suggestion that DatabaseMetaDataQuoter.needToQuote() needed to be changed--the patch looks good.)
Comment 4 Jaroslav Havlin 2013-02-08 11:20:01 UTC
Integrated as

Thank you very much for reporting, Ebakke, and for the patch, Matthias!
Comment 5 Quality Engineering 2013-02-10 01:41:23 UTC
Integrated into 'main-golden', will be available in build *201302092300* on (upload may still be in progress)
User: Jaroslav Havlin <>
Log: #225079: SQLIdentifiers.Quoter does not correctly quote identifiers containing the quote character itself

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo