LINQ group after select issue

Posts   
 
    
Colos
User
Posts: 15
Joined: 11-Mar-2009
# Posted on: 16-Apr-2009 10:29:49   

Hi!

I wanted to perform a pre-selection of data, and then use the selection, in particular for grouping.

Using a data access adapter da:


                LinqMetaData metaData = new LinqMetaData(da);

                var selection = from t in metaData.Text
                                select t;

                var groups = from s in selection
                             group s by s.Category into g
                             select g.Key;

                foreach (var v in groups)
                {
                    //do something
                }

I get the following exception:


A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>TestGoupLinq.vshost.exe</AppDomain><Exception><ExceptionType>SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException, SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27</ExceptionType><Message>An exception was caught during the execution of a retrieval query: ERROR: 42703: column LPA_L1.Category does not exist. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.</Message><StackTrace>   at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IRetrievalQuery queryToExecute, Dictionary`2 typeConvertersToRun)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IEntityFields2 fields, IRelationPredicateBucket filter, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IGroupByCollection groupByClause, Boolean allowDuplicates, Int32 pageNumber, Int32 pageSize)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider2.ExecuteValueListProjection(QueryExpression toExecute)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute(Expression expression)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.Execute()
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.System.Collections.Generic.IEnumerable&amp;lt;T&amp;gt;.GetEnumerator()
   at TestGoupLinq.Program.Main(String[] args) in C:\Users\cschenk\Desktop\TestGoupLinq\TestGoupLinq\Program.cs:line 30
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of a retrieval query: ERROR: 42703: column LPA_L1.Category does not exist. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. ---&amp;gt; Npgsql.NpgsqlException:
column LPA_L1.Category does not exist
Severity: ERROR
Code: 42703
   at Npgsql.NpgsqlConnector.CheckErrors()
   at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications()
   at Npgsql.NpgsqlCommand.ExecuteCommand()
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb)
   at Npgsql.NpgsqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior cb)
   at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)

If I do instead:


               var groups = from t in metaData.Text
                             group t by t.Category into g
                             select g.Key;

                foreach (var v in groups)
                {
                    //do something
                }

It works fine. Hence, the pre-selection seems to be the cause the failure. Is it because it is considered a nested query and grouping operations are not allowed on nested queries, or something alike?

My config is: libs runtime version: orm 2.6.09.0327 / linq 2.6.09.0331 Adapter - .NET 3.5 - WCF service PostgreSQL 8.3 - lib 2.6.0407 from this post: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15686

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 16-Apr-2009 12:57:40   

It might be related to the problem you received a fix for, earlier. We can't reproduce it on Sqlserver, as it's working properly (so it's not linq related).

Please post the generated SQL, perhaps it's another problem. Also please double-check that your service indeed uses the new DQE for postgres, which might not be the case (i.e. the old one is in the gac... etc.)

Colos
User
Posts: 15
Joined: 11-Mar-2009
# Posted on: 16-Apr-2009 13:58:15   

Hi Walaa,

I double-checked my assemblies. I think the application really references the proper, last ones, including the earlier fix for postgre Here is the SQL:


Generated Sql query: 
    Query: SELECT "LPA_L4"."ID" AS "F34_0", "LPA_L5"."ID" AS "F12_1", "LPA_L5"."STATUS" AS "F12_2", "LPA_L5"."DESCRIPTION" AS "F12_3", "LPA_L5"."ACCESSRULEACCESSRULE_ID_FK" AS "F12_4", "LPA_L5"."ARCHIVEMETARCHIVEMET_ID_FK" AS "F12_5", "LPA_L6"."ID" AS "F23_6", "LPA_L6"."ISPOTENTIAL" AS "F23_7", "LPA_L6"."INFORMATION_START" AS "F23_8", "LPA_L6"."INFORMATION_END" AS "F23_9", "LPA_L7"."ID" AS "F42_10", "LPA_L7"."CATEGORY" AS "F42_11", "LPA_L7"."TEXT" AS "F42_12" FROM ((( "switch_bg"."OBJECT" "LPA_L4"  LEFT JOIN "switch_bg"."DATAOBJECT" "LPA_L5"  ON  "LPA_L4"."ID"="LPA_L5"."ID") LEFT JOIN "switch_bg"."INFORMATION" "LPA_L6"  ON  "LPA_L5"."ID"="LPA_L6"."ID") LEFT JOIN "switch_bg"."TEXT" "LPA_L7"  ON  "LPA_L6"."ID"="LPA_L7"."ID")
Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query: 
    Query: SELECT "LPA_L3"."F42_11" FROM (SELECT "LPA_L4"."ID" AS "F34_0", "LPA_L5"."ID" AS "F12_1", "LPA_L5"."STATUS" AS "F12_2", "LPA_L5"."DESCRIPTION" AS "F12_3", "LPA_L5"."ACCESSRULEACCESSRULE_ID_FK" AS "F12_4", "LPA_L5"."ARCHIVEMETARCHIVEMET_ID_FK" AS "F12_5", "LPA_L6"."ID" AS "F23_6", "LPA_L6"."ISPOTENTIAL" AS "F23_7", "LPA_L6"."INFORMATION_START" AS "F23_8", "LPA_L6"."INFORMATION_END" AS "F23_9", "LPA_L7"."ID" AS "F42_10", "LPA_L7"."CATEGORY" AS "F42_11", "LPA_L7"."TEXT" AS "F42_12" FROM ((( "switch_bg"."OBJECT" "LPA_L4"  LEFT JOIN "switch_bg"."DATAOBJECT" "LPA_L5"  ON  "LPA_L4"."ID"="LPA_L5"."ID") LEFT JOIN "switch_bg"."INFORMATION" "LPA_L6"  ON  "LPA_L5"."ID"="LPA_L6"."ID") LEFT JOIN "switch_bg"."TEXT" "LPA_L7"  ON  "LPA_L6"."ID"="LPA_L7"."ID")) "LPA_L3" GROUP BY "LPA_L3"."F42_11"
Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query: 
    Query: SELECT "LPA_L1"."Category" FROM (SELECT "LPA_L3"."F42_11" FROM (SELECT "LPA_L4"."ID" AS "F34_0", "LPA_L5"."ID" AS "F12_1", "LPA_L5"."STATUS" AS "F12_2", "LPA_L5"."DESCRIPTION" AS "F12_3", "LPA_L5"."ACCESSRULEACCESSRULE_ID_FK" AS "F12_4", "LPA_L5"."ARCHIVEMETARCHIVEMET_ID_FK" AS "F12_5", "LPA_L6"."ID" AS "F23_6", "LPA_L6"."ISPOTENTIAL" AS "F23_7", "LPA_L6"."INFORMATION_START" AS "F23_8", "LPA_L6"."INFORMATION_END" AS "F23_9", "LPA_L7"."ID" AS "F42_10", "LPA_L7"."CATEGORY" AS "F42_11", "LPA_L7"."TEXT" AS "F42_12" FROM ((( "switch_bg"."OBJECT" "LPA_L4"  LEFT JOIN "switch_bg"."DATAOBJECT" "LPA_L5"  ON  "LPA_L4"."ID"="LPA_L5"."ID") LEFT JOIN "switch_bg"."INFORMATION" "LPA_L6"  ON  "LPA_L5"."ID"="LPA_L6"."ID") LEFT JOIN "switch_bg"."TEXT" "LPA_L7"  ON  "LPA_L6"."ID"="LPA_L7"."ID")) "LPA_L3" GROUP BY "LPA_L3"."F42_11") "LPA_L1"
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: DataAccessAdapterBase.OpenConnection
: Connection physically opened.
Method Exit: DataAccessAdapterBase.OpenConnection
A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 16-Apr-2009 14:54:13   

Your entities use inheritance, could you please give the proper tables, inheritance hierarchy type and entity definitions so we can reproduce it ?

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 16-Apr-2009 15:11:24   

Never mind, I reproduced it:

LinqMetaData metaData = new LinqMetaData(adapter);
var q1 = from c in metaData.Clerk
        select c;

var q = from c in q1
        group c by c.JobDescription into g
        select g.Key;

Inheritance fields are re-aliased as you can see in the query. The field referring to these fields must take that into account. There is logic in place to take care of this, however apparently it isn't solid enough. Will look into it.

For now, please use the direct approach as you stated in your first post, we'll look into how to fix this properly so you can use query fragments and build a query from that even in inheritance scenarios.

Interestingly, this works:


var q1 = from c in metaData.Clerk
        select c;

var q2 = from c in q1
        select c;

var q = from c in q2
        select c;

which gives:


SELECT DISTINCT [LPA_L1].[F7_0], [LPA_L1].[F7_1], [LPA_L1].[F7_2], [LPA_L1].[F7_3], [LPA_L1].[F4_4], [LPA_L1].[F4_5] 
FROM 
(
    SELECT [LPA_L2].[F7_0], [LPA_L2].[F7_1], [LPA_L2].[F7_2], [LPA_L2].[F7_3], [LPA_L2].[F4_4], [LPA_L2].[F4_5] 
    FROM 
    (
        SELECT  [LPA_L3].[EmployeeID] AS [F7_0], [LPA_L3].[Name] AS [F7_1], [LPA_L3].[StartDate] AS [F7_2],
                [LPA_L3].[WorksForDepartmentID] AS [F7_3], [LPA_L4].[ClerkID] AS [F4_4], [LPA_L4].[JobDescription] AS [F4_5] 
        FROM ( [InheritanceTwo].[dbo].[Employee] [LPA_L3]  LEFT JOIN [InheritanceTwo].[dbo].[Clerk] [LPA_L4]  ON 
                [LPA_L3].[EmployeeID]=[LPA_L4].[ClerkID])
    ) [LPA_L2]
) [LPA_L1] 
WHERE ( ( [LPA_L1].[F4_4] IS NOT NULL))

So the logic I referred to does work, however it apparently goes wrong with individual fields, as this fails too:


var q1 = from c in metaData.Clerk
        select c;

var q2 = from c in q1
         select new { c.JobDescription };

var q = from c in q2
        select c.JobDescription;

with the same error as you reported.

I hope to have a fix for you tomorrow (friday)

Frans Bouma | Lead developer LLBLGen Pro
Colos
User
Posts: 15
Joined: 11-Mar-2009
# Posted on: 16-Apr-2009 15:31:07   

To clarify my scenario, here is my inheritance structure regarding text entities: Object > DataObject > Information > Text

I hope to have a fix for you tomorrow (friday)

Great, thanks (no problem if it's later)!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 17-Apr-2009 11:55:24   

Fixed! simple_smile

It looked grim at first, but it turned out to be easily fixable. Please let me know if you run into issues with this new build

Frans Bouma | Lead developer LLBLGen Pro
Colos
User
Posts: 15
Joined: 11-Mar-2009
# Posted on: 17-Apr-2009 16:45:59   

Hello Frans, Thanks for the dll. It fixed the problem initially stated, but now, I unfortunately have a very similar error if I try to get an attribute from a related table, instead of using an attribute from the same table (i.e. I was using s.Category, now I try to get s.TextCategory.Code - Category is actually a foreign key to the look-up table TextCategory) confused .


                var selection = from t in metaData.Text
                                        select t;

                var groups = from s in selection
                             group s by s.TextCategory.Code into g
                             select g.Key;


Generated Sql query: 
    Query: SELECT "LPA_L5"."ID" AS "F34_0", "LPA_L6"."ID" AS "F12_1", "LPA_L6"."STATUS" AS "F12_2", "LPA_L6"."DESCRIPTION" AS "F12_3", "LPA_L6"."ACCESSRULEACCESSRULE_ID_FK" AS "F12_4", "LPA_L6"."ARCHIVEMETARCHIVEMET_ID_FK" AS "F12_5", "LPA_L7"."ID" AS "F23_6", "LPA_L7"."ISPOTENTIAL" AS "F23_7", "LPA_L7"."INFORMATION_START" AS "F23_8", "LPA_L7"."INFORMATION_END" AS "F23_9", "LPA_L8"."ID" AS "F42_10", "LPA_L8"."CATEGORY" AS "F42_11", "LPA_L8"."TEXT" AS "F42_12" FROM ((( "switch_bg"."OBJECT" "LPA_L5"  LEFT JOIN "switch_bg"."DATAOBJECT" "LPA_L6"  ON  "LPA_L5"."ID"="LPA_L6"."ID") LEFT JOIN "switch_bg"."INFORMATION" "LPA_L7"  ON  "LPA_L6"."ID"="LPA_L7"."ID") LEFT JOIN "switch_bg"."TEXT" "LPA_L8"  ON  "LPA_L7"."ID"="LPA_L8"."ID")
Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query: 
    Query: SELECT "LPA_L4"."CODE" AS "Code" FROM ((SELECT "LPA_L5"."ID" AS "F34_0", "LPA_L6"."ID" AS "F12_1", "LPA_L6"."STATUS" AS "F12_2", "LPA_L6"."DESCRIPTION" AS "F12_3", "LPA_L6"."ACCESSRULEACCESSRULE_ID_FK" AS "F12_4", "LPA_L6"."ARCHIVEMETARCHIVEMET_ID_FK" AS "F12_5", "LPA_L7"."ID" AS "F23_6", "LPA_L7"."ISPOTENTIAL" AS "F23_7", "LPA_L7"."INFORMATION_START" AS "F23_8", "LPA_L7"."INFORMATION_END" AS "F23_9", "LPA_L8"."ID" AS "F42_10", "LPA_L8"."CATEGORY" AS "F42_11", "LPA_L8"."TEXT" AS "F42_12" FROM ((( "switch_bg"."OBJECT" "LPA_L5"  LEFT JOIN "switch_bg"."DATAOBJECT" "LPA_L6"  ON  "LPA_L5"."ID"="LPA_L6"."ID") LEFT JOIN "switch_bg"."INFORMATION" "LPA_L7"  ON  "LPA_L6"."ID"="LPA_L7"."ID") LEFT JOIN "switch_bg"."TEXT" "LPA_L8"  ON  "LPA_L7"."ID"="LPA_L8"."ID")) "LPA_L3" LEFT JOIN "switch_bg"."TEXTCATEGORY" "LPA_L4"  ON  "LPA_L4"."CODE"="LPA_L3"."Category") GROUP BY "LPA_L4"."CODE"
Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query: 
    Query: SELECT "LPA_L1"."Code" FROM (SELECT "LPA_L4"."CODE" AS "Code" FROM ((SELECT "LPA_L5"."ID" AS "F34_0", "LPA_L6"."ID" AS "F12_1", "LPA_L6"."STATUS" AS "F12_2", "LPA_L6"."DESCRIPTION" AS "F12_3", "LPA_L6"."ACCESSRULEACCESSRULE_ID_FK" AS "F12_4", "LPA_L6"."ARCHIVEMETARCHIVEMET_ID_FK" AS "F12_5", "LPA_L7"."ID" AS "F23_6", "LPA_L7"."ISPOTENTIAL" AS "F23_7", "LPA_L7"."INFORMATION_START" AS "F23_8", "LPA_L7"."INFORMATION_END" AS "F23_9", "LPA_L8"."ID" AS "F42_10", "LPA_L8"."CATEGORY" AS "F42_11", "LPA_L8"."TEXT" AS "F42_12" FROM ((( "switch_bg"."OBJECT" "LPA_L5"  LEFT JOIN "switch_bg"."DATAOBJECT" "LPA_L6"  ON  "LPA_L5"."ID"="LPA_L6"."ID") LEFT JOIN "switch_bg"."INFORMATION" "LPA_L7"  ON  "LPA_L6"."ID"="LPA_L7"."ID") LEFT JOIN "switch_bg"."TEXT" "LPA_L8"  ON  "LPA_L7"."ID"="LPA_L8"."ID")) "LPA_L3" LEFT JOIN "switch_bg"."TEXTCATEGORY" "LPA_L4"  ON  "LPA_L4"."CODE"="LPA_L3"."Category") GROUP BY "LPA_L4"."CODE") "LPA_L1"
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: DataAccessAdapterBase.OpenConnection
: Connection physically opened.
Method Exit: DataAccessAdapterBase.OpenConnection
A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>TestGoupLinq.vshost.exe</AppDomain><Exception><ExceptionType>SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException, SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27</ExceptionType><Message>An exception was caught during the execution of a retrieval query: ERROR: 42703: column LPA_L3.Category does not exist. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.</Message><StackTrace>   at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IRetrievalQuery queryToExecute, Dictionary`2 typeConvertersToRun)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IEntityFields2 fields, IRelationPredicateBucket filter, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IGroupByCollection groupByClause, Boolean allowDuplicates, Int32 pageNumber, Int32 pageSize)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider2.ExecuteValueListProjection(QueryExpression toExecute)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute(Expression expression)
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.Execute()
   at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.System.Collections.Generic.IEnumerable&amp;lt;T&amp;gt;.GetEnumerator()
   at TestGoupLinq.Program.Main(String[] args) in C:\Users\cschenk\Desktop\TestGoupLinq\TestGoupLinq\Program.cs:line 30
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of a retrieval query: ERROR: 42703: column LPA_L3.Category does not exist. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. ---&amp;gt; Npgsql.NpgsqlException:
column LPA_L3.Category does not exist
Severity: ERROR
Code: 42703

And similarly, the compact version works OK...


var groups = from t in metaData.Text
                             group t by t.TextCategory.Code into g
                             select g.Key;

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 17-Apr-2009 17:45:42   

Hmm....


SELECT "LPA_L1"."Code" 
FROM 
(
    SELECT  "LPA_L4"."CODE" AS "Code" 
    FROM    
    (
        (
            SELECT  "LPA_L5"."ID" AS "F34_0", "LPA_L6"."ID" AS "F12_1", "LPA_L6"."STATUS" AS "F12_2", "LPA_L6"."DESCRIPTION" AS "F12_3", 
                    "LPA_L6"."ACCESSRULEACCESSRULE_ID_FK" AS "F12_4", "LPA_L6"."ARCHIVEMETARCHIVEMET_ID_FK" AS "F12_5", 
                    "LPA_L7"."ID" AS "F23_6", "LPA_L7"."ISPOTENTIAL" AS "F23_7", "LPA_L7"."INFORMATION_START" AS "F23_8", 
                    "LPA_L7"."INFORMATION_END" AS "F23_9", "LPA_L8"."ID" AS "F42_10", "LPA_L8"."CATEGORY" AS "F42_11", 
                    "LPA_L8"."TEXT" AS "F42_12" 
            FROM ((( "switch_bg"."OBJECT" "LPA_L5" LEFT JOIN "switch_bg"."DATAOBJECT" "LPA_L6" 
                        ON "LPA_L5"."ID"="LPA_L6"."ID") LEFT JOIN "switch_bg"."INFORMATION" "LPA_L7" 
                        ON "LPA_L6"."ID"="LPA_L7"."ID") LEFT JOIN "switch_bg"."TEXT" "LPA_L8" 
                        ON "LPA_L7"."ID"="LPA_L8"."ID")
        ) "LPA_L3" LEFT JOIN "switch_bg"."TEXTCATEGORY" "LPA_L4" 
            ON "LPA_L4"."CODE"="LPA_L3"."Category"
    ) GROUP BY "LPA_L4"."CODE"
) "LPA_L1

It's clearly in the join with the derived table. I wonder why it doesn't correct the name there. I've to look into this. Hopefully monday will bring better news simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 20-Apr-2009 11:28:12   

I fixed it. It was a big problem to fix this as the join is implicit (derived table is referred to through an entity in a normal relation object, which was properly handled but after the derived table fields were 'corrected'. By splitting this up it was fixed.

I've to run the big unit-test suite (all linq tests pass, so it should be ok) still and then will attach a new build.

(edit) See attached build for the fix.

Frans Bouma | Lead developer LLBLGen Pro
Colos
User
Posts: 15
Joined: 11-Mar-2009
# Posted on: 20-Apr-2009 14:42:53   

Thanks a lot Frans, it works indeed all right now! Colin