mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2025-11-13 09:53:53 +00:00
COUNT queries were generating incorrect SQL with the table appearing twice
This commit is contained in:
parent
3b2d05465e
commit
eefed23766
@ -165,13 +165,10 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st
|
||||
return
|
||||
}
|
||||
|
||||
// Create a pointer to the model type for database operations
|
||||
modelPtr := reflect.New(modelType).Interface()
|
||||
|
||||
logger.Info("Reading records from %s.%s", schema, entity)
|
||||
|
||||
query := h.db.NewSelect().Model(modelPtr)
|
||||
query = query.Table(tableName)
|
||||
// Use Table() with the resolved table name (don't use Model() as it would add the table twice)
|
||||
query := h.db.NewSelect().Table(tableName)
|
||||
|
||||
// Apply column selection
|
||||
if len(options.Columns) > 0 {
|
||||
|
||||
@ -197,8 +197,8 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st
|
||||
|
||||
logger.Info("Reading records from %s.%s", schema, entity)
|
||||
|
||||
query := h.db.NewSelect().Model(modelPtr)
|
||||
query = query.Table(tableName)
|
||||
// Use Table() with the resolved table name (don't use Model() as it would add the table twice)
|
||||
query := h.db.NewSelect().Table(tableName)
|
||||
|
||||
// Apply column selection
|
||||
if len(options.Columns) > 0 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user