Entity named "D" causes Internal Error on trying to run Aggregate

Entity named "D" causes Internal Error on trying to run Aggregate

  

Hi people,

This is more like a curiosity...

Anyone knows the reason why, on my personal (10.0.603.0) (probably any personal, who knows?), if I try to run a simple aggregate with the source set to a single entity called "D", I get an internal error?

Any other name works... :P

Not that the entity MUST be called D... But I am really curious... :)

Here is the stack:

Incorrect syntax near the keyword 'END'.
Environment InformationeSpaceVer: 3 (Id=560, PubId=578, CompiledWith=10.0.603.0)
RequestUrl: https://jauch.outsystemscloud.com/NestedJoinInAggregate/DS.aspx?(Not.Licensed.For.Production)= (Method: GET)
AppDomain: /LM/W3SVC/34/ROOT/NestedJoinInAggregate-6-131466998268789007
FilePath: C:\OutSystems\Sandboxes\X2PXKM031\Platform Server\running\NestedJoinInAggregate\DS.aspx
ClientIp: 89.115.83.82
Locale: en-US
DateFormat: yyyy-MM-dd
PID: 11092 ('w3wp', Started='8/8/2017 2:19:12 PM', Priv=314Mb, Virt=17859Mb)
TID: 99
Thread Name:
.NET: 4.0.30319.42000
Stack:Incorrect syntax near the keyword 'END'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at OutSystems.HubEdition.DatabaseProvider.SqlServer.ExecutionService.ExecutionService.ExecuteReader(IDbCommand cmd)
   at #Kxb.#Txb.ExecuteReader(String description, Boolean isApplication, Boolean transformParameters, Boolean skipLog)
   at OutSystems.Internal.Db.DatabaseAccessProvider`1.ExecuteQuery[T](Command cmd, GenericRecordList`1 rl, String description, Boolean transformParameters, Boolean skipLog)
   at OutSystems.Internal.Db.DatabaseAccessProvider`1.ExecuteQuery[T](Command cmd, GenericRecordList`1 rl, String description)
   at ssNestedJoinInAggregate.Flows.FlowMainFlow.ScrnDS.FuncssPreparation.datasetGetDS(HeContext heContext, Int32 maxRecords, IterationMultiplicity multiplicity, Int64& outParamCount, String qpstList_SortColumn_GetOrderBy, String qpstDS_SearchKeyword)
   at ssNestedJoinInAggregate.Flows.FlowMainFlow.ScrnDS.Preparation(HeContext heContext)
   at ssNestedJoinInAggregate.Flows.FlowMainFlow.ScrnDS.Page_Load(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Cheers,
Eduardo Jauch
Solution

Hi,

I had to try this...

On my environment I get the same error.

If you check the executed SQL code you'll notice that "EN" is added before the entity name (probably means Entity), making it "END" when passed to the SQL engine. If the entity is named Entity1, it will make it "ENEntity1".

END is a reserved word.

I would say it is certainly an unintended behavior and I didn't find any previous reference to it. Nice catch!

Solution

Bruno Fonte wrote:

Hi,

I had to try this...

On my environment I get the same error.

If you check the executed SQL code you'll notice that "EN" is added before the entity name (probably means Entity), making it "END" when passed to the SQL engine. If the entity is named Entity1, it will make it "ENEntity1".

END is a reserved word.

I would say it is certainly an unintended behavior and I didn't find any previous reference to it. Nice catch!


Hello Bruno, 

Bingo! xD
I couldn't look into the executed SQL because for some weird reason, it wasn't available!!! :S

In any case, thanks for the clarification! :)

Cheers!
Eduardo Jauch

PS: I think when adding prefix or suffix is always a good idea use symbols to guarantee this type of things will not happen... Seems OutSystems imposed a new reserved word for Entity names... "D"... xD

Eduardo Jauch wrote:

Bruno Fonte wrote:

Hi,

I had to try this...

On my environment I get the same error.

If you check the executed SQL code you'll notice that "EN" is added before the entity name (probably means Entity), making it "END" when passed to the SQL engine. If the entity is named Entity1, it will make it "ENEntity1".

END is a reserved word.

I would say it is certainly an unintended behavior and I didn't find any previous reference to it. Nice catch!


Hello Bruno, 

Bingo! xD
I couldn't look into the executed SQL because for some weird reason, it wasn't available!!! :S

In any case, thanks for the clarification! :)

Cheers!
Eduardo Jauch

PS: I think when adding prefix or suffix is always a good idea use symbols to guarantee this type of things will not happen... Seems OutSystems imposed a new reserved word for Entity names... "D"... xD

The generated SQL code:

SELECT TOP (32) END.[ID] o0, END.[NAME] o1FROM [DQG3R3026].DBO.[OSUSR_G4Z_D] END

Thanks Bruno! :)