Bug 90561 - Query-designer removes the SQL keyword AS in front of an Aliasname
Summary: Query-designer removes the SQL keyword AS in front of an Aliasname
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
4.3.1.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.2.0 target:5.1.3
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2015-04-10 21:22 UTC by Ulf
Modified: 2019-09-24 20:06 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot (69.52 KB, image/png)
2015-04-10 21:22 UTC, Ulf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulf 2015-04-10 21:22:30 UTC
Created attachment 114731 [details]
Screenshot

If you create a SQL Query as <Create Query in SQL View...> and use an AS in front of an Aliasname it is removed by <switch Design View On/Off> or by close and edit again.

The query works fine, but it is more readable for Humans if they stay. It worked before in older Versions of LibreOffice as well.

I use Win 8.1 and attached a screenshot
Comment 1 raal 2015-04-11 05:19:57 UTC
I can confirm with Version: 4.5.0.0.alpha0+
Build ID: b024e36ddb3b53163d7a01f6f7b5aadb7a858cd9
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2015-03-31_09:12:20

@Ulf:In which version it worked?
Comment 2 Ulf 2015-04-11 10:45:12 UTC
I can not remember but i tetsted the last version i have 4.3.6.2 and it is the same behavior.
Comment 3 Ulf 2015-04-11 14:28:05 UTC
Hi
I tested with older portable Versions of LibO from
http://downloadarchive.documentfoundation.org/libreoffice/old/

The last version i found, where the AS for aliasnames stayes was the 4.3.0.4
4.2.8.2 OK
4.3.0.4 OK
4.3.1.2 defekt
4.3.6.2 defekt 

I hope it will be help
Comment 4 raal 2015-04-11 16:35:48 UTC
(In reply to Ulf from comment #3)
> Hi
> I tested with older portable Versions of LibO from
> http://downloadarchive.documentfoundation.org/libreoffice/old/
> 
> The last version i found, where the AS for aliasnames stayes was the 4.3.0.4
> 4.2.8.2 OK
> 4.3.0.4 OK
> 4.3.1.2 defekt
> 4.3.6.2 defekt 
> 
> I hope it will be help

Thanks! It will help.
Comment 5 Matthew Francis 2015-04-12 05:36:02 UTC
This changed at the below commit.
Adding Cc: to serval2412@yahoo.fr; I see this relates to a deliberate change, but there is some discussion on the below mentioned bug as to when it should apply. Is this now the intended behaviour, including for built in databases?

    commit 568778874429595855b435792e5ebecd52956dae
    Author:     Julien Nabet <serval2412@yahoo.fr>
    AuthorDate: Tue Jul 22 18:36:05 2014 +0200
    Commit:     Julien Nabet <serval2412@yahoo.fr>
    CommitDate: Tue Jul 22 18:38:21 2014 +0200
    
        Resolves fdo#81213: Wrong table-clause generated by reportbuilder
    
        Oracle doesn't accept "AS" for making an alias from a table
        See https://bugs.freedesktop.org/show_bug.cgi?id=81213#c2
        https://bugs.freedesktop.org/show_bug.cgi?id=81213#c4
        https://bugs.freedesktop.org/show_bug.cgi?id=81213#c5
        for more information
    
        (thank you Lionel)
    
        Change-Id: I33c86d78b2590116d4af46ffd3e54c3c791268ea
Comment 6 Julien Nabet 2015-04-12 06:29:12 UTC
Matthew: it seems so since at least it works for every DB.
If not, perhaps we should add "UseKeywordAsBeforeAlias"/"AppendTableAliasInSelect" block in connectivity/registry/hsqldb/org/openoffice/Office/DataAccess/Drivers.xcu + "GenerateASBeforeCorrelationName" block in connectivity/source/drivers/hsqldb/HDriver.cxx.
Lionel: any thoughts?
Comment 7 Robinson Tryon (qubit) 2015-12-13 11:12:24 UTC Comment hidden (obsolete)
Comment 8 Lionel Elie Mamane 2016-03-25 05:42:54 UTC
(In reply to Julien Nabet from comment #6)
> Matthew: it seems so since at least it works for every DB.
> If not, perhaps we should add
> "UseKeywordAsBeforeAlias"/"AppendTableAliasInSelect" block in
> connectivity/registry/hsqldb/org/openoffice/Office/DataAccess/Drivers.xcu +
> "GenerateASBeforeCorrelationName" block in
> connectivity/source/drivers/hsqldb/HDriver.cxx.
> Lionel: any thoughts?

Adding "UseKeywordAsBeforeAlias" to hsqldb's Drivers.xcu (in the properties section) should work, yes. Technically, as both work, it does not matter. From a human POV I prefer seeing the "AS", too. You can add it.

If we do that, design view will add "AS" if it is not there, but I guess that is not a problem.

Adding GenerateASBeforeCorrelationName in HDriver.cxx should not be necessary.
Comment 9 Commit Notification 2016-03-26 08:29:32 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6807e21f5f8d7da8b9a7593a21eb09404712dd20

tdf#90561: Add AS keyword in Query-designer for hsqldb

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2016-03-28 20:57:12 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4d3ca45bf2e0a2b06ea897b5084184a57a299102&h=libreoffice-5-1

tdf#90561: Add AS keyword in Query-designer for hsqldb

It will be available in 5.1.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Robert Großkopf 2019-07-28 18:16:58 UTC
Couldn't confirm this bug has been fixed. Have tested it with LO 6.2.5.2. Created a query an added an alias for a field in the GUI. No "AS" appears in the SQL-code. Added "AS" to the SQL-code, changed back to the design view and then to SQL view. "AS" has been gone again.

All tested with an internal HSQLDB on LO 6.2.5.2 with OpenSUSE 15 64bit rpm Linux.
Comment 12 Julien Nabet 2019-09-24 20:06:14 UTC
(In reply to Robert Großkopf from comment #11)
> Couldn't confirm this bug has been fixed. Have tested it with LO 6.2.5.2.
> Created a query an added an alias for a field in the GUI. No "AS" appears in
> the SQL-code. Added "AS" to the SQL-code, changed back to the design view
> and then to SQL view. "AS" has been gone again.
> 
> All tested with an internal HSQLDB on LO 6.2.5.2 with OpenSUSE 15 64bit rpm
> Linux.

I gave a new try with master sources updated today but don't reproduce the bug.
Perhaps I missed something.

Lionel: any thoughts here?