keep trying

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-12 12:53:53 +08:00
parent ea3e82e54c
commit d0a64a8043
8 changed files with 55 additions and 80 deletions
+9
View File
@@ -95,6 +95,15 @@ async function paginate(model, req, {
const jsonbExclude = excludeAttributes.filter((f) => f.includes('.'));
const jsonbAttr = jsonbColumn ? excludeJsonbPaths(jsonbColumn, jsonbExclude) : null;
// The stripped jsonbAttr projection is aliased to the same name as the raw
// column (e.g. "personal_info") — without excluding the raw column too, it
// gets selected twice under the same alias, which Postgres/CockroachDB
// accept in a plain SELECT but reject as ambiguous the moment that alias is
// referenced in ORDER BY (e.g. sorting a jsonb-path column).
if (jsonbAttr && jsonbColumn && !topLevelExclude.includes(jsonbColumn)) {
topLevelExclude.push(jsonbColumn);
}
const attributes = modelToAttributes(model, { exclude: excludeAttributes, jsonbSchemas, context });
const ALLOWED_FIELDS = attributes.map((a) => a.field);
const computedFieldKeys = computedAttributes.map((c) => c.key);