Bug 42713 - query design view loses SQL comments
Summary: query design view loses SQL comments
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
(earliest affected)
3.4.3 release
Hardware: Other All
: medium minor
Assignee: Not Assigned
Depends on:
Blocks: Database-Queries
  Show dependency treegraph
Reported: 2011-11-08 08:24 UTC by Lionel Elie Mamane
Modified: 2022-12-21 03:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2011-11-08 08:24:25 UTC
SQL comments are lost when going through design view and back.

There would be two ways to fix that:

1) Don't throw comments away to form the SQL parse tree, but introduce a "comment" node. This is robust against changes to the SQL, but can introduce all kinds of bugs in code that does not expect a "comment" node.

2) In general, don't touch parts of the SQL string that are not modified. That is, each SQL parse tree node is decorated with the string that it was parsed from, and the parse tree -> string transformation function uses these to regenerate the original string; a new node (that was added directly, not from parsing a string) would not have this annotation and the parse tree -> string transformation would then fallback to generating a fresh string. This would at least not loose comments that are not just before (or after, dependending on whether the comment is grouped with the node before or after it) a modified node.

   If we take this route, we will probably need to fork the parse tree -> string function into two variants:
   1) with the current behaviour;
   2) with the behaviour above.
   Number 1 would be used for generating SQL to be sent to the DB engine, and number 2 for SQL to show the user and/or being stored.

   It would also be nice to have a UI way to manually force a string -> parse tree -> string round-trip with the last step being done by number 1, if the user wishes so. Call it e.g. "canonicalise SQL". For this use, it would be nice for number 1 to *not* strip off comments, while for sending to DB, comments stripped off is good. So make it a boolean option in that function.
Comment 1 Alex Thurgood 2015-01-03 17:38:51 UTC Comment hidden (no-value)
Comment 2 QA Administrators 2016-01-17 20:03:40 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2017-03-06 14:12:33 UTC Comment hidden (obsolete)
Comment 4 Alex Thurgood 2018-12-20 09:51:45 UTC
Problem still unresolved in LO6132
Comment 5 QA Administrators 2020-12-20 03:46:03 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2022-12-21 03:20:17 UTC
Dear Lionel Elie Mamane,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team