diff --git a/internal/postgres/postgres.go b/internal/postgres/postgres.go index 97db786..c668d4c 100644 --- a/internal/postgres/postgres.go +++ b/internal/postgres/postgres.go @@ -341,7 +341,7 @@ func FillIDMinimum(MapTable map[string]*types.Table) { DefaultValueSQL := create_files.FindTextDefaultValueSQL(TypeGo) TextSQL = `SELECT Min("` + NameID + `") as id_minimum FROM "` + Schema + `"."` + TableName + `" WHERE " + NameID + " <> ` + DefaultValueSQL } else { - TextSQL = `SELECT "` + NameID + `" as id_minimum FROM "` + Schema + `"."` + TableName + `" WHERE " + NameID + " is not null LIMIT 1` + TextSQL = `SELECT "` + NameID + `" as id_minimum FROM "` + Schema + `"."` + TableName + `" WHERE " + NameID + " is not null ORDER BY ` + NameID + `LIMIT 1` } ctx, ctxCancelFunc := context.WithTimeout(ctxMain, time.Second*60) defer ctxCancelFunc()