Query errors
Thrown as QueryError (code: "query"). Each entry is an identifier (error.id), then the message as the error states it, where {expression} stands for the value of that expression in the source ({…} for one too long to show), then what to do about it: the text useFullErrorMessages(messages) and explain(error) add, where {name} stands for the error's parameter of that name. See Errors.
query.addErrorMessage
addError() takes the message as a string.
Pass the message as a string, as in addError("email", "is taken").
query.aggregateArgument
{method}() takes an expression.
Pass an expression, such as p.views.
query.aggregateField
repo.aggregate(query, "{fn}") needs the field to aggregate.
Name the field: repo.aggregate(query, "{fn}", "views").
query.aggregateFunction
repo.aggregate() was given the function {JSON.stringify(fn)}.
repo.aggregate() takes "count", "sum", "avg", "min" or "max".
query.aggregateRootSchema
repo.aggregate() over the field "{field}" needs a query whose root binding is a schema; this one reads {…}.
Aggregate a query rooted at a schema class, or compute the aggregate in the query's own select and read it with repo.one(…).
query.aggregateSubquerySelect
repo.aggregate() over "{field.name}": this query is aggregated as a subquery ({reason}).
The query must select the column "{field}" of its root binding "{alias}": whole rows of the root, or an object whose key "{field}" is that column. Otherwise compute the aggregate in the query's own select and read it with repo.one(…).
query.aggregateUnknown
The aggregate "{String(node.name)}" is not in the {ctx.dialect.name} aggregate table.
Use the aggregates the query builder offers, or write the call as a fragment.
query.aggregateUnknownColumn
repo.aggregate(): {schemaMeta.name} has no column "{field}"{…}. Its columns are: {names}.
Aggregate a stored field of the schema; a virtual field has no column.
query.aliasMissing
{clause}() needs an alias for the binding.
Give the binding an alias, a non-empty string: {clause}(User, "u").
query.aliasProto
{clause}(): a binding cannot be named "__proto__".
Choose another alias: the bindings are passed to callbacks as one object keyed by alias.
query.aliasReserved
{clause}() was given the alias "{alias}".
Aliases that start with "$" are reserved for the bindings the builder adds itself; choose another.
query.aliasTaken
{clause}() was given the alias "{alias}", which this query already uses{…}.
Each binding needs its own alias; for a self-join, give the second one another name.
query.applyActionUnknown
applyAction(): "{String(action)}" is not an action.
Use "insert", "update", "delete", "replace" or "ignore".
query.applyChangesNewRecord
applyChanges() and applyAction() need a changeset of a loaded row (or one without a schema class); this one is of a new {spec.name}.
A row the database never returned cannot exist. Insert it with the repo instead.
query.assocConstraintKind
assocConstraint(): "{assoc}" is a {found.kind} association.
It applies to belongsTo associations; for the other side, use noAssocConstraint.
query.assocJoinName
{clause}() takes the name of an association second.
Pass the name of an association second: {clause}("{from}", "posts", "{name}").
query.assocJoinNoSchema
{clause}("{start.alias}", "{assocName}", …): the binding "{start.alias}" has no schema, so it has no associations.
Start the join from a binding of a schema class.
query.assocJoinStart
{clause}() takes the alias of the binding to start from first.
Pass the alias of the binding to start from first: {clause}("u", "posts", "p").
query.assocJoinUnknown
{clause}("{start.alias}", "{assocName}", …): {startMeta.name} has no association "{assocName}". Its associations are: {…}.
Name an association the schema declares as a static member.
query.assocJoinUnknownStart
{clause}("{fromAlias}", …) starts from a binding this query does not have. Its bindings are: {visibleAliases(scope0).join(", ")}.
Start from a binding the query has: the root alias, or one a join added.
query.assocUnknown
{ownerMeta.name} has no association "{name}". Its associations are: {…}.
Name an association the schema declares as a static member.
query.astBooleanOperator
Unknown boolean operator "{String(op)}".
Unknown boolean operator "{String(node.op)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astCaseEmpty
A CASE has no WHEN branch.
The query tree is malformed: caseWhen() needs at least one branch when it is called, so this one was built or changed by hand.
query.astCastType
A cast has no column type to cast to.
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astCrossJoinCondition
A cross join has no condition.
The query tree is malformed: crossJoin() takes no condition, so this one was built or changed by hand.
query.astCteName
A CTE has no name.
The query tree is malformed: withCte() refuses an empty name when it is called, so this one was built or changed by hand.
query.astFragmentStringType
A fragment's strings must be strings.
The query tree is malformed: a fragment made with the fragment`…` tag always has string parts.
query.astFragmentStrings
A fragment must have exactly one more string than it has arguments.
The query tree is malformed: a fragment made with the fragment`…` tag always has one more string than arguments.
query.astIdent
fragment.ident() holds a name that is not an identifier, so it was not written.
The query tree is malformed: fragment.ident() refuses such names when it is called, so this one was changed afterwards.
query.astIdentifier
An identifier is not a string.
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astInsertCell
Unknown insert cell kind "{String((cell as { kind: unknown }).kind)}".
The insert plan is malformed: the repo never produces this cell kind.
query.astInsertSource
An insert's source is values, cells or a query.
The insert plan is malformed: the repo always passes values, cells or a query.
query.astJoinKind
Unknown join kind "{String(node.type)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astJsonPathEmpty
A JSON path has no keys.
The query tree is malformed: path() refuses an empty path when it is called, so this one was built or changed by hand.
query.astLiteral
A literal holds something other than true, false, null or a finite number; only those are written into the SQL.
Bind every other value with val(value); only those few are written into the SQL text.
query.astLock
A lock is a lock clause or a fragment.
The query tree is malformed: lock() takes a mode or a fragment, so this one was built or changed by hand.
query.astNodeKind
Unknown expression node kind "{String(kind)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astNullsOrder
Unknown nulls order "{String(node.nulls)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astOperation
Unknown query operation "{String(operation)}".
Pass "all", "updateAll" or "deleteAll".
query.astOperator
Unknown operator "{String(op)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astParamCount
The query's params hold {ast.params.length} values, but its parameter nodes hold {…}.
Build queries with from(), or compute params with collectParams.
query.astParamName
A named parameter has no name.
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astSelectObject
A select object has a different number of keys and values.
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astSelectShape
Unknown select shape "{String((shape as { kind: unknown }).kind)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astSetOperation
Unknown set operation "{String(combination.op)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astSortDirection
Unknown sort direction "{String(node.direction)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astSourceAlias
A source has no alias.
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astSourceAliasTwice
The alias "{alias}" names two sources of one query.
Give each source its own alias.
query.astSourceKind
Unknown source kind "{String((source as { kind: unknown }).kind)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astTupleEmpty
A tuple has no items.
The query tree is malformed: tuple() refuses an empty list, so this one was built or changed by hand.
query.astUnaryOperator
Unknown unary operator "{String(op)}".
The query tree is malformed: queries built with from() and the builder methods never produce this, a tree built or changed by hand can. If it came from the builder, please report it.
query.astWindowName
A window name is not an identifier, so it was not written.
The query tree is malformed: windows() refuses such names when it is called, so this one was changed afterwards.
query.batchStepName
batch.{method}(): a step cannot be named "__proto__".
Choose another name for the step: its result is kept under it.
query.batchStepTwice
The batch already has a step named "{name}".
Step names are unique: their results are kept under them.
query.booleanArguments
{method}() takes boolean expressions.
Pass boolean expressions, such as u.age.gte(18).
query.booleanExpected
{method}() takes a boolean expression.
Pass a boolean expression, such as u.age.gte(18), or true or false.
query.buildAssocKeyValue
buildAssoc(): values sets {field}, the key that points at the {ownerMeta.name} row, to another value.
Leave it out: buildAssoc sets it.
query.buildAssocKind
buildAssoc(): "{name}" is {…} association.
buildAssoc makes a child of a hasOne or hasMany; for the others, insert the row and use putAssoc.
query.buildAssocParent
buildAssoc(): the parent must be a {ownerMeta.name} row.
Pass a loaded {owner} row, as returned by a query or a write.
query.buildAssocParentKey
buildAssoc(): the {ownerMeta.name} row has no value for {…}, the key the child points at.
Pass a row that has its key: one returned by a query or a write.
query.buildAssocSchema
buildAssoc() takes the schema class first.
Pass the schema class first: buildAssoc(User, user, "posts", { … }).
query.buildAssocUnknown
buildAssoc(): {ownerMeta.name} has no association "{String(name)}".
Name an association the schema declares.
query.callbackExpected
{clause}() takes a callback that receives the bindings.
Pass a callback that receives the bindings: {clause}(({ u }) => …).
query.caseCondition
{method}() takes a boolean expression as its condition.
Pass a boolean expression, such as u.age.lt(18).
query.castEmbed
cast(): "{name}" is an embed.
Cast it with castEmbed("{name}", …) instead.
query.castEmptyValues
cast(): emptyValues must be an array.
Pass emptyValues as an array, as in { emptyValues: ["", "n/a"] }.
query.castNestedWithoutParams
{fn}("{relation.name}") reads the params given to cast(), and this changeset was made with change().
Use {embed} for values you trust.
query.castPermitted
cast() takes the permitted field names as an array.
Pass the permitted field names as an array: cast(User, params, ["email"]).
query.castType
{method}() takes a field type.
Pass a field type, such as t.integer() or t.string(), to name the type.
query.changeEmbed
change(): "{key}" is an embed.
Change it with putEmbed("{key}", …) instead.
query.changeValues
change() takes the values as an object.
Pass the values as an object: change(User, { email: "…" }).
query.changesetConstructor
Changeset has no public constructor.
Make one with cast(User, params, [...]) or change(User, values).
query.changesetFieldUnknown
{fn}(): {spec.name} has no field "{name}". Its fields are: {[...spec.fields.keys()].join(", ")}.
Name one of the schema's fields; a typo is the usual cause.
query.changesetSource
{fn}() takes a schema class (for a new record), a row (for an update), a changeset, or { data, types } for a changeset without a schema class.
Pass a schema class (for a new record), a row (for an update), a changeset, or { data, types } for a changeset without a schema class.
query.checkConstraintName
checkConstraint() needs the constraint's name.
Pass the constraint's name: checkConstraint("age", { name: "users_age_check" }).
query.checkoutEnded
This checkout already ended: the repo it gave was used after its callback returned or threw (a promise that outlived the callback?).
Await every call inside the callback.
query.closeNotRoot
close() closes the whole repo and its pool.
Call it on the repo createRepo made, not on the repo of a transaction, a checkout or a sandbox.
query.coalesceArguments
coalesce() needs at least two arguments.
Pass at least two expressions or values, as in coalesce(u.nickname, u.name).
query.columnKindUnsupported
The column type kind "{String(db.kind)}" has no SQL name in {dialect.name}.
See Dialect support for the column types {dialect} has, or use a custom type with its SQL name.
query.combinedClause
This query is combined with union(), intersect() or except(), and only orderBy(), limit(), offset(), more set operations, withCte() and schema() apply to the combined rows.
Add any other clause to a side before combining, or wrap the combined query: from(subquery(q), "s").
query.combinedOrderBy
orderBy() on a query combined with union(), intersect() or except() sorts the combined rows, so it can only use expressions the query selects.
Order by expressions the query selects, or by their names with selectedAs(…).
query.combinedOrderByAmbiguous
orderBy() on a query combined with union(), intersect() or except() names an expression the query selects more than once (the same expression with other values counts as the same).
Name the one to sort by with selectedAs(…) and order by that name.
query.compareNull
{method}() was given null.
A comparison with null is always unknown in SQL, so it would match nothing: use isNull() or isNotNull(), or isDistinctFrom() to compare treating null as a value.
query.compileArgument
compile() takes a query.
Pass a query: from(User, "u")….
query.compileFragmentArgument
compileFragment() takes a fragment.
Pass a fragment: fragment`select …`.
query.concatEmpty
concat() needs at least one part to append.
Pass at least one value or expression to append.
query.conditionExpected
{clause}() needs its callback to return a condition; it returned {describeValue(value)}.
Return a condition from the callback, such as ({ u }) => u.age.gte(18).
query.conditionNotBoolean
{clause}() needs a condition, and its callback returned the {type.name} expression{column}.
Compare it: {clause}(({ u }) => u.age.gte(18)).
query.constraintMatch
{fn}(): match must be "exact", "suffix" or "prefix".
Pass match: "exact" (the default), "suffix" or "prefix".
query.constraintMessage
{fn}(): message must be a string.
Pass the message as a string, as in { message: "is taken" }.
query.constraintName
{fn}(): name must be a non-empty string.
Pass the name as a non-empty string, as in { name: "users_email_key" }.
query.constraintNoTable
{fn}(): {…} has no table, so the constraint has no default name.
Pass it: { name: "…" }.
query.constraintOptions
{fn}(): the options must be an object.
Pass the options as an object, as in { name: "users_email_key" }.
query.constraintUnknownAssoc
{fn}(): {this.#spec.name} has no association "{String(name)}".
Name an association the schema declares.
query.cteFragmentBody
The CTE "{node.name}" has a fragment body, which can only be read.
Read the CTE in the main query; to write rows, run the statement on its own.
query.cteMaterialized
withCte("{name}", …): materialized is true or false, or left out to let the database decide.
Pass materialized: true or false, or leave it out to let the database decide.
query.cteName
withCte() takes a name first, a non-empty string.
Pass a name first, a non-empty string: withCte("tree", query).
query.cteNameTwice
The CTE name "{cte.name}" is used twice in one query.
Give each CTE its own name.
query.cteOptions
withCte("{name}", query, options) takes its options as an object.
Pass the options as an object: { recursive: true }.
query.cteRecursive
withCte("{name}", …): recursive is true or false.
Pass recursive: true or false, or leave it out.
query.cteShape
The source "{source.alias}" reads the CTE "{source.name}" as { {keys} }, but the query given to withCte("{source.name}", …) returns {…}.
Refer to it with the same query: cte("{name}", query).
query.cteSourceEmbedded
cte("{name}", {schemaMeta.name}): an embedded schema has no rows of its own.
Pass the schema class of a table, or the CTE's query.
query.cteSourceName
cte() takes the name of a CTE first, a non-empty string.
Pass the CTE's name first, a non-empty string: cte("tree", Category).
query.cteSourceShape
cte("{name}", shape) takes the schema class of its rows.
Pass the schema class of its rows, cte("{name}", Category), or the CTE's query.
query.cteTwice
withCte("{name}", …): this query already has a CTE named "{name}".
Give each CTE its own name.
query.cteUndefined
The source "{alias}" reads the CTE "{source.name}", which the query does not define.
Define it on the query with withCte("{name}", query), or read another source.
query.cteUnknownOption
withCte("{name}", …) has no option "{key}".
withCte() takes recursive and materialized.
query.cteWithPreloads
withCte("{name}", …): the query has preloads, which a CTE cannot run.
Preload in the query that reads the CTE.
query.cteWithUpdate
withCte("{name}", …): the query has set(…) assignments.
A CTE that writes rows is not supported; run the update on its own.
query.customTypeSql
A custom column type's sql is not a plain type name (letters, digits, underscores, single spaces or dots, an optional (n) or (n, m) and [] pairs), so it was not written into the SQL.
Give the custom type a plain SQL type name, such as "citext", "numeric(10, 2)" or "public.mood[]".
query.deferrableUnsupported
A deferrable transaction (deferrable: true) is not supported by {dialect}.
Leave deferrable out on {dialect}.
query.deleteNoKey
A row delete needs at least one field to find the row by.
The delete plan is malformed: the repo always finds the row by its primary key.
query.distinctTwice
distinct() was called on a query that already has a distinct.
A query has one distinct: call distinct() once, with every expression it needs.
query.dynamicBinding
A dynamic expression needs the binding "{alias}" of {schema.name}, which this query {…}.
Use the dynamic expression in a query that has the binding "{alias}" of {schema}, or build it for this query's bindings.
query.dynamicCallback
dynamic() takes a callback that receives the bindings.
Pass a callback that receives the bindings: dynamic(({ u }) => u.age.gte(18)).
query.dynamicCombine
{method}() on a dynamic expression takes another dynamic expression.
Pass another dynamic expression: a.{method}(dynamic(…)).
query.dynamicCondition
dynamic {method}(): both sides must be conditions.
Combine conditions, such as dynamic(({ u }) => u.age.gte(18)).
query.dynamicFieldBinding
field() takes a binding first.
Pass a binding first, such as u in ({ u }) => field(u, name).
query.dynamicFieldUnknown
field() was given {…}, which is not a column of the binding. Its columns are: {columns.join(", ")}.
Name a column of the binding; check the name a request supplied before building the query.
query.dynamicSchemaClass
dynamic({ {alias} }, …): "{alias}" must name a schema class.
Name a schema class, such as { {alias}: User }.
query.dynamicSchemas
dynamic(schemas, callback) takes the schemas it needs by alias first.
Pass the schemas by alias first: dynamic({ u: User }, ({ u }) => …).
query.dynamicSecondCallback
dynamic(schemas, callback) takes a callback second.
Pass a callback second: dynamic({ u: User }, ({ u }) => u.age.gte(18)).
query.emitterTwice
The node kind "{kind}" already has an emitter.
Register each node kind once.
query.errorKey
{fn}(): the error key must be a non-empty string other than "__proto__".
Pass a field name, or another non-empty key, as in addError("base", "…").
query.excludeCombined
exclude("{clause}") on a query combined with union(), intersect() or except() would change its left side only.
Exclude it from that side before combining, or exclude("setOperations") first.
query.excludeGroupByHaving
exclude("groupBy") would leave a having() without its groupBy().
Exclude "having" first: q.exclude("having").exclude("groupBy").
query.excludeUnknown
exclude() was given {…}, which is not a clause it removes.
exclude() takes where, select, distinct, groupBy, having, orderBy, limit, offset, lock, preload, set, windows, withCte or setOperations.
query.existsQuery
exists() takes a query.
Pass a query built with from(), as in exists(from(Post, "p").where(({ p }) => p.authorId.eq(u.id))).
query.explainAnalyze
explain's analyze option is true or false.
Pass analyze: true or false, or leave it out.
query.explainAnalyzeJson
explain with both analyze and format "json" is not supported by {this.dialect.name}.
Use one of the two on {dialect}.
query.explainAnalyzeUnsupported
explain's analyze option is not supported by {this.dialect.name}.
Leave the option out on {dialect}.
query.explainFormat
explain's format option is "text" or "json".
Pass format: "text" or "json", or leave it out.
query.explainFormatUnsupported
explain's format option is not supported by {this.dialect.name}.
Leave the option out on {dialect}.
query.expressionExpected
{clause}() needs its callback to return an expression or an array of them, such as ({ u }) => [u.id]; it returned {describeValue(item)}{…}.
Return an expression or an array of them from the callback, such as ({ u }) => [u.id].
query.fieldIsAssoc
{fn}(): "{name}" is an association of {spec.name}, not a field.
Associations are changed through castAssoc and putAssoc.
query.fieldNameType
{fn}() takes a field name as a string.
Pass the field name as a string.
query.fieldNotEmbed
field() reads a field of an embedded row, and this expression is {…}.
Use it on a t.embedOne() field; for other JSON use path() or pathText().
query.fieldNotReadable
field(): {embedded.name}.{field.name} is {…}, which field() cannot read as its type.
Read it with path("{column}") instead.
query.fieldUnknown
field(): {embedded.name} has no stored field {…}. Its fields are: {…}.
Name a stored field of the embedded schema.
query.fieldValidatorPromise
The field validator of "{field}" returned a Promise.
An async validator runs with validateFieldAsync(); validateField() is synchronous.
query.filterArgument
{clause}() takes a callback or an object of field values.
Pass a callback, or an object of field values: {clause}({ role: "admin" }).
query.filterCondition
filter() takes a boolean expression.
Pass a boolean expression, such as p.published or p.views.gt(10).
query.filterUndefined
{clause}({ {key}: undefined }) on {label}: undefined is not a value, and a filter that silently disappears matches every row.
Leave the key out, or add the clause only when there is a value: if (value !== undefined) q = q.where({ {key}: value }).
query.filterUnknownField
{clause}({ {key} }) names a field that {label} does not have as a column. Its columns are: {names.join(", ")}.
Use a field name the schema declares (not its column name); a virtual field cannot be filtered on.
query.formatPattern
validateFormat() takes a regular expression.
Pass a regular expression, such as /^[^@\s]+@[^@\s]+$/.
query.fragmentCall
fragment is a tagged template.
Write the SQL between backquotes, fragment`lower(…)`, not fragment(text). Calling it as a function would turn a string into SQL text, so it is refused.
query.fragmentOrderItem
fragment() was given an order item (asc() or desc()), which is not an expression.
Interpolate the expression, and write ASC or DESC in the template.
query.fragmentValue
fragment() binds strings, numbers, bigints, booleans, dates, bytes, null, and arrays of those (one array parameter).
An array of expressions is not bound: interpolate each expression on its own. For a JSON value pass val(value, t.json()).
query.functionUnknown
The function "{String(node.name)}" is not in the {ctx.dialect.name} function table.
Use the functions the query builder offers, or write the call as a fragment, interpolating its arguments: fragment`my_function(…)`.
query.getByValues
repo.{method}() takes an object of field values.
Pass an object of field values: repo.{method}(User, { email: "ada@example.com" }).
query.getCompositeId
repo.get({schemaMeta.name}, id): {schemaMeta.name} has a composite primary key, so the id is an object of its fields: {expected}.
Pass the id as an object with a value for every key field.
query.getIdArray
repo.get({schemaMeta.name}, id): the key field "{field.name}" holds one value, but it was given an array.
To read several rows by key, use repo.all(from({name}, "x").where(({ x }) => x.{name1}.in(ids))).
query.getIdField
repo.get({schemaMeta.name}, id): the id has no value for the key field "{name}" (it is {String(value)}); the id is {expected}.
Give every key field a value; null or undefined usually means a value missing upstream.
query.getIdObject
repo.get({schemaMeta.name}, id): the primary key of {schemaMeta.name} is the single field "{field.name}".
The id is the value of the key field, as in repo.get({schema}, 42).
query.getIdUnknownField
repo.get({schemaMeta.name}, id): "{name}" is not a field of the primary key of {schemaMeta.name}; the id is {expected}.
Pass only the key fields in the id object.
query.getMissingId
repo.get({schemaMeta.name}, {String(id)}): the id is {String(id)}.
This is almost always a missing value upstream (an unparsed route parameter, a field that was never set); check it before reading.
query.getNoPrimaryKey
repo.get({schemaMeta.name}, id): {schemaMeta.name} has no primary key, so it cannot be read by id.
Use repo.getBy({name}, { … }) instead.
query.havingCallback
{clause}() takes a callback.
Pass a callback: {clause}(({ p }) => count(p.id).gt(3)).
query.havingWithoutGroupBy
having() filters groups, and this query has no groupBy() yet.
Add groupBy(…) before having(…), or use where() to filter rows.
query.identName
fragment.ident() takes an identifier.
Pass an identifier: a letter or underscore, then letters, digits, underscores or $ (/^[A-Za-z_][A-Za-z0-9_$]*$/). The name given does not match, so it was refused.
query.inOperand
{op}() takes an array of values, an expression of array type, or a query.
Pass an array of values, as in u.id.in([1, 2, 3]), an expression of array type, or a query that selects one column.
query.inclusionValues
{fn}() takes the values as an array.
Pass the values as an array, as in {fn}("role", ["admin", "member"]).
query.insertAllMixedColumns
repo.insertAll(): row {row} has no value for {schemaMeta.name}.{field.name}, which other rows give (they give {columns.map((column) => column.name).join(", ")}), and {dialect} cannot write DEFAULT in a VALUES list.
Give every row the same fields, or insert the rows in groups of the same fields.
query.insertAllNeverWritable
repo.insertAll(): row {r} gives a value for {schemaMeta.name}.{field.name}, which the database owns (writable: "never").
Leave the field out of the rows: the database fills it.
query.insertAllQuerySelect
repo.insertAll({schemaMeta.name}, query): the query must select an object whose keys are the fields to fill.
Select an object whose keys are the fields to fill, such as .select(({ u }) => ({ email: u.email, name: u.name })).
query.insertAllQueryValue
repo.insertAll(): a row holds a query as a value.
A subquery that selects one value is written scalar(query), which also types it.
query.insertAllSelectNeverWritable
repo.insertAll(): the query selects {schemaMeta.name}.{field.name}, which the database owns (writable: "never").
Leave the field out of the select: the database fills it.
query.insertAllSelectValue
repo.insertAll({schemaMeta.name}, query): the select's "{key}" is not one SQL value (a plain value is kept out of the statement, and a binding is a whole row).
Select an expression; for a value, val(value, t.integer()).
query.insertCellsColumns
An insert of cells needs a column list.
The insert plan is malformed: the repo always gives an insert of cells its columns.
query.insertCellsRowLength
Row {r} of the insert has {row.length} cells for {columns.length} columns.
Give every row one cell per column.
query.insertDefaultsNoColumn
{meta.name} has no column to insert defaults into.
Give the schema a column the database fills, or insert values.
query.insertLoadedRow
repo.{method}() takes a changeset of a new record (made from the class, cast({schemaMeta.name}, …)); this one is of a loaded row.
Update it with repo.update(), or use repo.insertOrUpdate().
query.insertNoRow
The insert into {schemaMeta.name} reported no row written.
The database reported no row for the insert; check triggers or rules on the table that may skip it.
query.insertNoRows
An insert of cells needs at least one row.
Pass at least one row; insertAll() of an empty list runs no statement.
query.insertQueryColumns
An insert from a query needs a column list.
The insert plan is malformed: the repo always gives an insert from a query its columns.
query.insertRowCount
An insert's row count is a whole number of zero or more.
The insert plan is malformed: the repo always passes a whole number of rows.
query.insertRowTooWide
One row of {columns} values is more than the {maxParams} parameters a statement may have.
Write fewer columns per row, or split the table: a statement may have at most {maxParams} parameters.
query.insertValuesRows
An insert of values needs a whole number of rows, at least one.
The insert plan is malformed: the repo always passes a whole number of rows, at least one.
query.isolationUnsupported
The isolation level "{isolation}" is not supported by {dialect}.
See Dialect support for the isolation levels {dialect} has.
query.joinPreloadCallbackLimit
{label}: its callback preloads "{many}" from a join, and its limit or offset would count the joined rows, not the rows of {route.targetMeta.name}, giving a parent fewer than it asks for.
Preload "{many}" with a separate query instead (preload("{many}") in the callback).
query.joinPreloadLimit
This query preloads "{many}" from a join, and {what} would count the joined rows, not the parents, cutting their "{many}" short.
Preload "{many}" with a separate query instead (preload("{many}"), or a callback with its own per-parent limit), or read the rows with repo.all() and no limit.
query.joinPreloadNoKey
A join preload merges the result rows of each {schemaMeta.name} by its primary key, and {schemaMeta.name} has none.
Preload with a separate query instead.
query.joinPreloadUnderThrough
{label}: a nested preload from a join is not supported under a {…} association.
Preload the nested association with a separate query instead.
query.jsonPathKey
A key of a JSON path is a string or a whole number from 0.
Pass the keys as strings, or whole numbers from 0 for array positions.
query.jsonPathKeyExpression
A key of a JSON path on {ctx.dialect.name} must be a value (a string or a whole number), not an expression.
Pass the keys of the path as strings or whole numbers.
query.jsonPathKeyQuote
A key of a JSON path holds a double quote or a backslash, which this database cannot read in a path.
Read such a key with a fragment, or store the JSON with keys without quotes and backslashes.
query.lateralReference
The column {alias}.{String(node.field)} is read by a subquery in FROM or a join from a binding of the same query, "{alias}", which needs a lateral join.
Lateral joins are not supported yet: move the condition to the join's on, or use the subquery in where with exists() or in().
query.lengthCount
validateLength(): count must be "graphemes", "codepoints" or "bytes".
Pass count: "graphemes" (the default), "codepoints" or "bytes".
query.lengthNoLimit
validateLength() needs at least one of is, min and max.
Pass is, min or max, as in validateLength("name", { min: 2 }).
query.lengthOptions
validateLength() takes its limits as an object.
Pass the limits as an object: { min: 2, max: 80 }.
query.lengthWholeNumbers
validateLength(): is, min and max must be whole numbers, 0 or more.
Pass whole numbers of 0 or more, as in { min: 2, max: 80 }.
query.limitValue
{clause}() takes a non-negative whole number or a named parameter, {clause}(param("{clause}", t.integer())); it was given {…}.
Pass a non-negative whole number, or a named parameter: {clause}(param("{clause}", t.integer())).
query.listNull
{op}() was given a list holding null.
x {operator} (…, NULL) never matches the null: filter it out and add isNull() separately.
query.listParamsUnsupported
A list of values outside in() needs array parameters, which {ctx.dialect.name} does not have.
Use the list with in(), which expands it to one parameter per item, or see Dialect support for what {dialect} supports.
query.listUndefined
{op}() was given a list holding undefined, which is not a value.
Remove the undefined items from the list; every item must be a value.
query.litValue
lit() takes true, false, null or a finite number, which are written into the SQL.
Every other value is bound: use val(value) instead.
query.lockArgument
lock() takes a mode ("update", "share", "noKeyUpdate", "keyShare") or a fragment of SQL for any other lock clause.
Pass a mode ("update", "share", "noKeyUpdate", "keyShare"), or a fragment of SQL for any other lock clause.
query.lockClause
The lock clause "{clause}" is not one {ctx.dialect.name} accepts as a string.
Use a fragment for that lock clause: lock(fragment`…`).
query.lockCombined
A row lock cannot be combined with union(), intersect() or except().
Lock the rows in a separate query, or lock each side before combining.
query.lockIncrementer
optimisticLock(): the incrementer must be a function.
Pass a function that makes the next value, as in optimisticLock("version", (v) => v + 1).
query.lockMode
lock() takes "update", "share", "noKeyUpdate" or "keyShare", optionally with { skipLocked } or { noWait }, or a fragment for any other lock clause.
Pass "update", "share", "noKeyUpdate" or "keyShare", optionally with { skipLocked: true } or { noWait: true }, or a fragment for any other lock clause.
query.lockNoValue
optimisticLock(): "{field}" has no value to compare.
Give the field a default, such as t.integer().default(1).
query.lockNotNumber
optimisticLock(): "{field}" is not a number, so it has no default increment.
Only a number or a bigint has a default increment: pass a function that makes the next value as the second argument of optimisticLock().
query.lockOptions
lock() takes its options as an object.
Pass the options as an object: { skipLocked: true } or { noWait: true }.
query.lockSkipAndNoWait
lock() takes skipLocked or noWait, not both.
Choose one: a lock either skips locked rows or fails on them.
query.lockUnknownOption
lock() has no option {unknownKeys.map((k) => `"${k}"`).join(", ")}.
lock() takes skipLocked and noWait.
query.mergeActions
merge(): the changesets have different actions ("{this.action}" and "{other.action}").
Merge changesets with the same action, or set one with applyAction() first.
query.mergeArgument
merge() takes another changeset.
Pass another changeset, as in a.merge(b).
query.mergeOtherRecord
merge(): the changesets are not of the same record.
Merge changesets made from the same row (or class, for a new record).
query.messageFunctionResult
A message function must return the message as a string.
Return the message as a string from the message function, as in (meta) => "must be at least " + meta.min.
query.messageOption
{fn}(): message must be a string or a function that returns one.
Pass a string, or a function that returns one, as in { message: "is required" }.
query.namedParamMissing
The query needs the named parameter{…} {missing.map((name) => `"${name}"`).join(", ")}, which {…} not given a value.
Pass a value for every named parameter in the params argument: repo.all(q, { {first}: … }).
query.namedParamUnknown
The query has no named parameter{…} {extra.map((name) => `"${name}"`).join(", ")}{…}.
Pass only the named parameters the query declares with param().
query.nestedAssocNotEmbed
{fn}(): "{name}" is an association of {meta(model).name}, not an embed.
Use {fn}("{name}", …).
query.nestedChildSchema
{fn}("{relation.name}"): the child changesets must be of {relation.targetMeta.name}, but one is of {…}.
Make every child changeset from {target}, or from one of its rows.
query.nestedDuplicate
{fn}("{relation.name}"): the same {relation.targetMeta.name} is given twice.
Give each row once.
query.nestedEmbedNotAssoc
{fn}(): "{name}" is an embed field of {ownerMeta.name}, not an association.
Use {fn}("{name}", …).
query.nestedName
{fn}() takes the name as a string.
Pass the name of the association or embed as a string.
query.nestedNoChangeset
{fn}("{relation.name}"): {relation.targetMeta.name} has no static changeset function.
Give the schema a static changeset function, or pass one: { with: (row, params) => cast(row, params, [...]) }.
query.nestedNoSchema
{fn}(): a changeset without a schema class has no associations.
Make the changeset from a schema class or a row to change associations.
query.nestedNotArray
{fn}("{relation.name}"): {relation.ownerName}.{relation.name} holds a list.
Give an array of values.
query.nestedNotEmbed
{fn}(): "{name}" is not an embed field (it is {field.type.name}).
{fn} changes fields declared with t.embedOne or t.embedMany; change other fields with {other}.
query.nestedOptions
{fn}("{relation.name}", options): the options must be an object.
Pass the options as an object, such as { required: true }.
query.nestedRequired
{fn}(): required must be true or false.
Pass required: true or false, or leave it out.
query.nestedRowSchema
{fn}("{relation.name}"): a row given must be a {relation.targetMeta.name}.
Pass a {target} row, a changeset of one, or a plain object of its fields.
query.nestedThroughReadOnly
{fn}(): "{name}" of {ownerMeta.name} is a has-through association (through {assoc.through.join(", ")}), which is read-only.
Change the associations it goes through instead.
query.nestedTransactionLeftRunning
A nested transaction was still running when its enclosing transaction's callback returned, so the enclosing one was rolled back.
Await tx.transaction(…) inside the callback.
query.nestedTransactionOpen
A nested transaction is open on this tx.
Run the statements on the repo the nested callback was given (tx.transaction(async (inner) => …) runs them on inner), or await the nested transaction first.
query.nestedUndefined
{fn}("{relation.name}", undefined).
Give {what}.
query.nestedUnknownAssoc
{fn}(): {ownerMeta.name} has no association "{name}". {…}.
Name an association the schema declares.
query.nestedUnknownField
{fn}(): {ownerNameOf(model)} has no field "{name}".
Name an embed field the schema declares.
query.nestedUnknownKey
{fn}("{relation.name}"): {targetMeta.name} has no field or association "{key}".
Pass only the fields and associations {target} declares.
query.nestedUnknownOption
{fn}(): unknown option "{key}".
The options are with and required.
query.nestedValue
{fn}("{relation.name}"): each value is a {relation.targetMeta.name} row, a changeset of one, or a plain object of its fields, but one is {describe(value)}.
Pass a {target} row, a changeset of one, or a plain object of its fields for each value.
query.nestedWith
{fn}(): with must be the function that makes a child changeset.
Pass with: (row, params) => cast(row, params, [...]), the function that makes a child changeset.
query.noAssocConstraintKind
noAssocConstraint(): "{assoc}" is {…} association.
It applies to hasOne and hasMany associations with a foreign key.
query.noDialectTable
adapter.{method}() cannot compile for {dialect}: this build of egon-orm has no SQL dialect table for it.
Run SQL text with adapter.execute() instead.
query.notFromFrom
A query is made with from(): from(User, "u").
Make a query with from(), as in from(User, "u").
query.notWholeNumber
A value of an integer type is not a whole number.
Give a fraction a float type, val(2.5, t.float()), or round it.
query.nullNotAllowed
{method}() was given null, which it cannot take.
Pass a value; to test for SQL NULL use isNull() or isNotNull().
query.numberLimit
validateNumber(): {key} must be a number.
Pass the limit as a number (or a bigint for bigint fields), as in { lessThan: 100 }.
query.numberNoLimit
validateNumber() needs at least one limit.
Pass at least one limit, such as { greaterThan: 0 }.
query.numberOptions
validateNumber() takes its limits as an object.
Pass the limits as an object: { greaterThan: 0 }.
query.numberUnknownOption
validateNumber(): unknown option "{key}". The options are {Object.keys(NUMBER_CHECKS).join(", ")} and message.
Pass only the options validateNumber() takes, as in { greaterThan: 0 }.
query.onConflictKey
{where} has the keys target and update; "{key}" is not one of them.
Pass { target, update }, as in onConflict: { target: ["email"], update: "all" }.
query.onConflictNested
repo.{method}(): onConflict cannot be combined with changes of associations: a row that is not inserted has no children to write.
Write the parent first, then the children.
query.onConflictNoColumn
{meta.name} has no column to write onConflict with.
Write a schema that has columns, or leave onConflict out.
query.onConflictNoUpdate
onConflict's update leaves no column to update.
Use onConflict: "nothing" instead.
query.onConflictOption
{where} is "nothing" or { target, update }, but it is {describe(option)}.
(There is no spelling for "raise": leave the option out.)
query.onConflictShape
onConflict is "nothing" or { target, update }.
Pass onConflict: "nothing", or { target, update }, as in { target: ["email"], update: "all" }.
query.onConflictTarget
onConflict with update needs a target on {ctx.dialect.name}.
Name the target: the conflicting fields, { constraint } or a fragment.
query.onConflictTargetEmpty
onConflict's target lists no field.
List at least one field in the target, or give { constraint: name } or a fragment.
query.onConflictTargetOption
{where}'s target is a list of field names, { constraint: "name" } or a fragment, but it is {describe(rawTarget)}.
Pass a list of field names, { constraint: "name" } or a fragment as the target.
query.onConflictTargetShape
onConflict's target is a list of fields, { constraint: name } or a fragment.
Pass a list of fields, { constraint: name } or a fragment as the target.
query.onConflictUpdate
onConflict's update is "all", a list of fields or { except }.
Pass update: "all", a list of fields, or { except: [fields] }.
query.onConflictUpdateOption
{where}'s update is "all", a list of field names or { except: [...] }, but it is {describe(rawUpdate)}.
To ignore a conflict, use onConflict: "nothing".
query.onReplaceError
{fn}("{relation.name}"): the new value leaves out {…} that {relation.ownerName}.{relation.name} has, and its onReplace is "error".
Say what happens to {them}, for example with {fix}; the options are "invalid", "delete"{assocModes}{oneModes}.
query.onReplaceSetNull
{fn}("{relation.name}"): onReplace is "setNull", but {relation.targetMeta.name}.{name} is not nullable.
Make it .nullable(), or use onReplace "delete".
query.onReplaceUpdateNull
{fn}("{relation.name}"): onReplace "update" reuses the row of {relation.ownerName}.{relation.name} for a new value, so it cannot remove it.
Use onReplace "delete", "deleteIfExists" or "setNull" to allow null.
query.orderExpected
{clause}() needs its callback to return an expression, an order item (u.createdAt.desc()) or an array of them; it returned {describeValue(item)}{…}.
Return an expression, an order item (u.createdAt.desc()) or an array of them from the callback.
query.outerJoinAfterSelect
{clause}() makes the rows of the bindings before it optional, and this query already has {…} that take them as they are.
Add the {clause}() before {this}.
query.outerRefAlias
outerRef() takes the alias of the outer binding first.
Pass the alias of the outer binding first: outerRef("u", User).
query.outerRefEmbedded
outerRef("{alias}", {schemaMeta.name}): an embedded schema has no table, so no query binds it.
Pass the schema class of a table: an embedded schema has no table, so no query binds it.
query.outerRefSchema
outerRef("{alias}", …) takes the schema class of that binding second.
Pass the schema class of that binding second: outerRef("{alias}", User).
query.outerRefShadowed
outerRef("{alias}", {required.name}) refers to the binding "{alias}" of an outer query, but the query using it has its own binding "{alias}", which would be read instead.
Give one of them another alias.
query.outerRefWrongSchema
outerRef("{alias}", {required.name}) expects the outer binding "{alias}" to be {required.name}, but it is {…}.
Pass the schema class of the outer binding: outerRef("{alias}", {found}).
query.overArgument
over() takes the name of a window, or { partitionBy, orderBy, frame }.
Pass the name of a window declared with windows(), or { partitionBy, orderBy, frame }.
query.overFrame
over(): frame is a fragment.
Pass a fragment, such as fragment`ROWS BETWEEN 1 PRECEDING AND CURRENT ROW`.
query.overName
over() takes the name of a window declared on the query, an identifier (/^[A-Za-z_][A-Za-z0-9_$]*$/), or a window.
Declare the window with windows({ w: ({ p }) => ({ partitionBy: [p.authorId] }) }) and pass its name, over("w"), or pass the window itself.
query.overTwice
over() was already called on this aggregate.
Call over() once per aggregate; declare the window with all its parts in that call.
query.paramArguments
param() takes a name and a field type.
Pass a name and a field type, as in param("minAge", t.integer()).
query.paramName
param(): a named parameter cannot be named "__proto__".
Choose another name: the values are passed as one object keyed by name.
query.paramNotWholeNumber
{label} has the type {wholeTypeName(slot)} (its own, or that of the column beside it), but its value is not a whole number.
Give a fraction a float type, val(2.5, t.float()), or round it.
query.paramTwoTypes
The named parameter "{x.name}" is used with two types, {left} and {…}.
A named parameter has one type: give the other use its own name.
query.paramsMissing
The query needs the named parameter "{name}", which was not given a value.
Pass a value for every named parameter, as in repo.all(q, { {name}: … }).
query.paramsUnknown
The query has no named parameter{…} {extra.map((name) => `"${name}"`).join(", ")}; it takes {original.map((name) => `"${name}"`).join(", ")}.
Pass only the named parameters the query declares with param().
query.pathEmpty
{method}() needs at least one key.
Pass at least one key, as in path("address", "city").
query.pathKey
{method}() takes keys that are strings, or whole numbers for array positions.
Pass keys as strings, or whole numbers for array positions, as in path("tags", 0).
query.pathNotJson
{method}() reads inside a JSON value, and this expression has the type {value.type.name}.
Use it on a t.json() or embedded field, or on a fragment.
query.pgCursorMissing
Streaming rows from Postgres needs the "pg-cursor" package, which is not installed.
Add it with: pnpm add pg-cursor
query.pipeFunction
pipe() takes a function from query to query.
Pass a function from query to query: q.pipe(published).
query.placeholdersMissing
repo.insertAll(): the rows use the named parameter{…} {missing.map((name) => `"${name}"`).join(", ")}.
Give their values in the placeholders option: repo.insertAll(Schema, rows, { placeholders: { {name}: … } }).
query.placeholdersUnused
repo.insertAll(): placeholders {unknown.map((name) => `"${name}"`).join(", ")} {…} not used by any row; {…}.
Use one in a row as param("{unknown}", type).
query.preloadBelowSelected
repo.preload(): "{node.assoc}" of {schemaMeta.name} is loaded as selected values, not rows, so nothing can be preloaded below it.
Load it again with { force: true }.
query.preloadBindingNotJoined
preload({ {here}"{value}" }): "{value}" is a binding of this query, but it was not joined through the association "{key}"{…}, so it cannot fill it.
Join it with joinAssoc("{parent}", "{key}", "{value1}"), or name a nested association of {name}.
query.preloadCallbackArgument
preload("{name}", …) takes a function from query to query as its second argument.
Pass a function that takes the query and returns it with clauses added: preload("{name}", (q) => q.limit(3)).
query.preloadCallbackName
preload() with a callback takes one association name first.
Pass one association name first: preload("posts", (q) => q.limit(3)).
query.preloadCallbackOtherQuery
preload("{name}", callback): the callback must return the query it receives (rooted at {meta(target).name} as "{name}"), with clauses added.
Return the query the callback receives, with clauses added, not a new query.
query.preloadCallbackResult
preload("{name}", callback): the callback must return a query, the one it receives with clauses added; it returned {describeValue(result)}.
Return the query the callback receives, with clauses added.
query.preloadCallbackTwice
preload "{node.assoc}" is given a callback twice.
Put everything in one callback.
query.preloadFrom
preload({ {here}{ $from: {…} } }): $from names the binding to fill "{key}" from, which must be joined through that association.
Join the binding through that association first: joinAssoc("{parent}", "{key}", "{source}").
query.preloadLimitKey
{label}: limit and offset apply per parent, which needs {route.targetMeta.name} to have a primary key to rank its rows by.
Give {target} a primary key, or preload without limit and offset.
query.preloadLimitOrder
limit in preload "{name}" needs an orderBy: the limit and offset of a preload apply per parent, and pick rows by order.
Add orderBy(({ {name} }) => …) to the callback, or an orderBy option to the association.
query.preloadMixedRows
{method} was given rows of {schemaMeta.name}, but {…} is a row of {…}.
Rows of different schemas are preloaded in separate calls.
query.preloadNamedParams
repo.preload() runs its callback at once, so its query takes values, not named parameters ({names.map((name) => `"${name}"`).join(", ")}).
Write the values into the query.
query.preloadNoAssociations
preload() loads associations of a schema, and the root binding "{root.alias}" has none.
Preload from a query whose root binding is a schema with associations.
query.preloadOptionalRoot
preload() attaches associations to the rows of the root binding "{root.alias}", which a right or full join makes optional.
Preload in a query without that join.
query.preloadOptionalRows
preload("{name}", callback): the callback's query has a right or full join, which makes the rows of "{name}" optional, and a preloaded association needs rows that exist.
Use an inner or left join.
query.preloadSelect
A query with preloads must return the whole rows of its root binding.
Select the whole root binding, or preload in a separate query.
query.preloadSelectKey
preload "{name}" selects without its key.
Add `{key}: {name}.{key}` to the select.
query.preloadSelectedShape
preload() attaches associations to whole rows, and this query selects {…}.
Preload before selecting a shape, or select the root binding: select(({ {alias} }) => {alias}).
query.preloadSpec
preload() takes an association name, an array, an object of nested preloads, or a name and a callback; {…} given {describeValue(spec)}.
Pass an association name, an array, an object of nested preloads, or a name and a callback, as in preload("posts", (q) => q.limit(3)).
query.preloadTwice
preload "{node.assoc}" is declared twice, once from {…} and once from {…}.
Load it one way.
query.preloadUnknown
preload({…}): {schemaMeta.name} has no association "{name}". Its associations are: {…}.
Name an association the schema declares as a static member.
query.preloadUnknownAssoc
{owner.name} has no association "{node.assoc}" to preload.
Preload an association the schema declares.
query.prepareFunction
prepareChanges() takes a function.
Pass a function from changeset to changeset, as in prepareChanges((cs) => cs.putChange("slug", slugify(cs.getField("title")))).
query.prepareQuery
prepare() takes a query.
Pass a query: prepare(from(User, "u").where(…)).
query.putChangeEmbed
{fn}(): "{field.name}" is an embed.
Change it with putEmbed.
query.putChangeUndefined
{fn}("{field.name}", undefined): undefined is not a value.
Use null for no value, or deleteChange("{name}") to remove the change.
query.rawArgument
repo.raw() takes a fragment, and was given {…}.
Pass a fragment: repo.raw(fragment`select …`). Values go into the template as interpolations, where they are bound.
query.readEmbedded
{schemaMeta.name} is an embedded schema: it is stored inside its parent's row and has no table to read.
Read the parent schema, and the embedded values from its rows.
query.readOnlyUnsupported
A read-only transaction (readOnly: true) is not supported by {dialect}.
Leave readOnly out on {dialect}.
query.readQueryWhere
repo.{method}() adds its clauses with the query's where(); this query object has no where() method.
Pass a query built with from(), or a schema class.
query.reloadNoKeyValue
repo.reload(): a row of {schemaMeta.name} has no value for its key field "{field.name}", so it cannot be found again.
Reload rows read from the database, which have their keys.
query.reloadNoPrimaryKey
repo.reload(): {schemaMeta.name} has no primary key, so its rows cannot be found again.
Read the rows again with a query.
query.removesNamedParam
{clause} would remove the named parameter "{name}", which the query's type still requires.
Build the query without that clause instead.
query.requiredFields
validateRequired() takes a field name or a list of them.
Pass a field name or a list of them, as in validateRequired(["email", "name"]).
query.returningOption
repo.{method}(): returning is true or a list of field names, but it is {describe(returning)}.
Pass returning: true for every field, or a list of field names, as in returning: ["id", "createdAt"].
query.returningTwice
returning() was called on a query that already has a {…}.
A query returns one shape: exclude("select") first.
query.returningWithPreloads
returning() was called on a query with preloads.
An update or delete cannot preload: exclude("preload") first.
query.reverseOrderNone
reverseOrder() reverses the query's orderBy, and this query has none; its root "{root.alias}" has no primary key to order by either.
Add an orderBy() first.
query.rollbackOutside
rollback() is only available inside a transaction.
Call it on the tx that repo.transaction(async (tx) => …) gives the callback.
query.rollbackSandbox
The sandbox's transaction is rolled back by sandbox.rollback(), not by rollback() on the repo sandbox.begin() returned.
Roll the sandbox back with sandbox.rollback(), in afterEach.
query.rootInSandboxTransaction
The repo was used inside one of its own transaction callbacks, in the test sandbox.
Only calls on the tx the callback was given are inside the transaction; outside the sandbox this call would run on another connection, outside it, and in the sandbox's one connection it cannot. Pass tx to the code you call (or, if the call is meant to commit on its own, test it without the sandbox).
query.sandboxOpen
sandbox.begin() was called while a sandbox is already open on this repo.
Call sandbox.rollback() after each test (afterEach) before the next begin().
query.sandboxRolledBack
This sandbox transaction was already rolled back: sandbox.rollback() ran before this call.
Await every call inside the test.
query.savepointOptions
tx.{method}() inside a transaction runs in a savepoint, which cannot take isolation, readOnly or retries.
Give isolation, readOnly and retries to the outermost transaction.
query.savepointRollbackFailed
This transaction could not roll back to one of its savepoints (see the cause), so its state is unknown: it can only be rolled back as a whole.
Let the error propagate so that the whole transaction is rolled back, then run it again.
query.scalarArgument
scalar() takes a query that selects one value.
Pass a query that selects one value: scalar(from(Post, "p").select(() => count())).
query.scalarShape
scalar() takes a query that selects one expression, and this query selects {…}.
Select one expression, such as select(() => count()).
query.schemaName
schema() takes the name of a database schema.
Pass the name of a database schema: schema("tenant_1").
query.schemalessData
{fn}({ data, types }): data must be a plain object holding the current values.
Pass the current values as a plain object, or {} when there are none.
query.schemalessFieldName
"{name}" cannot be the name of a field.
Rename the field: "constructor", "__proto__", "toJSON" and names that start with "$" are reserved.
query.schemalessFieldType
The type of the field "{name}" is not a field type.
Give each field a type made with t, as in {name}: t.string().
query.schemalessGenerated
The field "{name}" is {…}, which means nothing without a table.
Use .default() for a value it should start with.
query.schemalessShape
A changeset without a schema class needs { data, types }, where types is an object from field name to type.
Pass { data, types }, as in { data: {}, types: { q: t.string(), page: t.integer() } }.
query.selectBinding
{clause}() was given the whole binding "{info.alias}"{where(path)}, which has no schema to read rows of.
Select its columns one by one.
query.selectBindingSchema
The select returns "{alias}" as rows of {meta.name}, but that binding yields {…}.
Select the binding as the rows its source yields.
query.selectDuplicateColumn
The select list has two output columns named "{item.alias}".
Give one of them another name.
query.selectMergeResult
selectMerge() needs its callback to return an object of keys to add; it returned {describeShape(extra.node.shape)}.
Return an object of keys to add, as in selectMerge(({ p }) => ({ title: p.title })).
query.selectMergeShape
selectMerge() adds keys to an object select, and this query {…}.
Select an object first: select(({ u }) => ({ id: u.id })).
query.selectMissing
The query has no select, and its root binding "{root}" has no schema to read rows of.
Add a select.
query.selectOnUpdate
select() was called on a query with set(…) assignments, an update.
Declare what the update returns with returning(): returning(({ p }) => p.id).
query.selectOrderItem
{clause}() was given an order item (asc() or desc()){where(path)}.
Order items belong in orderBy(); select the expression itself.
query.selectQuery
{clause}() was given a query{where(path)}.
A query is not a value: select an expression, or use a subquery expression.
query.selectTuple
{clause}() was given a row value (tuple){where(path)}.
A row value is compared, not selected: select its items.
query.selectTwice
select() was called on a query that already has a {…}.
A query has one: use selectMerge() to add keys, or exclude("select") first.
query.selectUnknownBinding
The select returns the whole binding "{alias}", which the query does not have.
Select a binding the query has.
query.selectValue
{clause}() was given a {…}{where(path)}, which is not a value.
Select expressions, bindings and plain values.
query.selectWithPreloads
{clause}() was given a select that is not the whole root binding "{this.#scope.root.alias}", and the query preloads {…}.
Preloaded associations are attached to whole rows: select ({ {this} }) => {this}, or preload in a separate query.
query.selectedAsExpression
selectedAs(expr, "{name}") takes an expression to name first.
Pass an expression to name first, such as sum(p.views).
query.selectedAsInClause
{clause}(): selectedAs("{node.name}") refers to a selected value by its name, which {clause}() cannot read: the database names selected values after this clause is computed.
Use the expression itself; names are for orderBy() and groupBy().
query.selectedAsName
selectedAs() takes a name, a non-empty string.
Pass a name, a non-empty string: selectedAs(sum(p.views), "total").
query.selectedAsSelected
selectedAs("{expr.name}") without an expression refers to a selected value.
Select the expression itself, and name it: selectedAs(expr, "{name}").
query.selectedAsUnknown
selectedAs("{String(node.name)}") refers to a selected value of that name, and the query selects none.
Name one in the select: selectedAs(expr, "{String}").
query.setArgument
set() takes an object of field values, or a callback that returns one.
Pass an object of field values, or a callback that returns one: set({ published: true }), set(({ p }) => ({ views: p.views.add(1) })).
query.setEmpty
set() was given no field.
Set at least one field: set({ published: true }).
query.setNotTable
set() updates the rows of a table, and the root binding "{root.alias}" is not a schema's table.
Update a query rooted at a schema class: from(Post, "p").set({ published: true }).
query.setNullNotNullable
set({ {key}: null }): {meta.name}.{key} is not nullable.
Set the field to a value, or make it .nullable() in the schema (and the column nullable in the database).
query.setOperationArgument
{method}() takes another query.
Pass another query: q.{method}(from(Post, "p").select(…)).
query.setOperationClause
{method}() was called on a query with {clause}.
On a combined query those apply to the combined rows, not to this side: add them after {method}(), or, to order or limit this side alone, wrap it: from(subquery(q), "s").
query.setOperationLock
{method}(): a query with a row lock cannot be combined with another.
Lock the rows in a separate query, or remove lock() from the side.
query.setOperationPlainValue
{method}(): a side selects a plain value{at(path)}, which is returned as it is and never sent to the database, so the rows of the other side would get it too.
Select it as a value with a type: val(value, t.string()).
query.setOperationPreloads
{method}(): {side} has preloads, which a set operation cannot carry.
Preload in a query over the combined rows, or exclude("preload") first.
query.setOperationShapes
{method}(): the two sides return different shapes{at(path)}: this query returns {describe(a)}, the other {describe(b)}.
Columns are combined by position, so both must select the same shape, with keys in the same order.
query.setOperationUpdate
{method}(): {side} has set(…) assignments.
An update cannot be combined with a query: run it on its own.
query.setUndefined
set({ {key}: undefined }): undefined is not a value.
Leave the key out, or pass null to store NULL.
query.setUnknownField
set({ {key} }): {meta.name} has no {…} "{key}". Its columns are: {columns.join(", ")}.
Set only stored fields of the schema; a virtual field has no column to update.
query.setWithPreloads
set() was called on a query with preloads.
An update cannot preload: exclude("preload") first.
query.setWithSelect
set() was called on a query with a select.
An update says what it returns with returning(), not select(): exclude("select"), then returning(({ p }) => p.id).
query.sourceEmbedded
{clause}() was given {schemaMeta.name}, an embedded schema: it is stored inside its parent's row and has no table to query.
Query the parent schema, and read the embedded values from its rows (or with field() and path() in a query).
query.sourceInvalid
{clause}() takes a schema class ({clause}(User, "{alias}")) or a source such as subquery(q) or cte(name, Schema).
Pass a schema class, as in {clause}(User, "{alias}"), or a source such as subquery(q) or cte(name, Schema).
query.sourceIsQuery
{clause}() does not take a query.
To continue a query, call more methods on it; to use it as a source, wrap it: {clause}(subquery(q), "{alias}").
query.sourceIsUpdate
{method}(): the query has set(…) assignments, an update.
Only a query that reads can be a source; run the update on its own.
query.sourceSchemaMismatch
The source "{alias}" is declared with the schema {declared.name}, but {what} selects rows of {inner.meta.name}.
Declare the source with the schema its query selects.
query.sourceShape
{method}() reads a query as a source, so the query must select an object of expressions or whole rows of a schema; it selects {what}.
Select an object of expressions, as in select(({ p }) => ({ id: p.id, title: p.title })), or whole rows of a schema.
query.sourceWithPreloads
{method}(): the query has preloads, which a query read as a source cannot run.
Exclude them first: exclude("preload").
query.streamOpen
A stream is still open on this connection.
Finish it, or leave its for-await loop (break or return), before running another statement or stream on the same connection.
query.streamPreload
repo.stream() cannot preload associations: the rows are yielded one at a time, before their associations could be loaded.
Stream the parents without preload, or read them in batches with repo.all(query.limit(n).offset(…)) and preload each batch.
query.subqueryArgument
subquery() takes a query.
Pass a query: subquery(from(Post, "p").select(…)).
query.subqueryExpected
{method}() takes a query, which did not produce a subquery expression.
Pass a query built with from(), with a select() of one expression.
query.subqueryIsUpdate
A query with set(…) assignments, an update, was used as a subquery.
Only a query that reads can be a subquery: leave out set(…), or run the update on its own with repo.updateAll().
query.subqueryWithPreloads
A query with preloads was used as a subquery.
A subquery returns values to its enclosing query, and cannot run preloads: exclude("preload") first.
query.subsetValues
validateSubset() takes the values as an array.
Pass the values as an array, as in validateSubset("tags", ["a", "b"]).
query.sumType
{method}() adds up numbers, and this expression has the type {expr.type.name}.
Pass an expression of a numeric type (integer, bigint, float or decimal).
query.throughKey
assoc({meta(schema).name}, …, "{name}"): {route.targetMeta.name} needs a primary key of exactly one field to be found through a has-through chain.
Give the target schema a single-field primary key, or preload the chain one association at a time.
query.throughLimitAmbiguous
{label}: limit and offset apply per parent, and a row of {route.targetMeta.name} can be reached along more than one path of this has-through chain, so it would be counted more than once.
Preload without limit, or preload the chain's associations themselves.
query.tooManyParams
The statement has {ctx.slots.length} parameters, more than the {ctx.dialect.capabilities.maxParams} {ctx.dialect.name} accepts.
Split it into smaller statements.
query.transactionEnded
transaction already completed: tx was used after its callback returned or threw (a promise that outlived the callback?).
Await every call on tx inside the callback.
query.transactionFailed
A statement in this transaction failed (see the cause), so the transaction can only be rolled back: Postgres refuses every further statement in it, and Egon does the same on every database.
Roll back (throw, or tx.rollback(reason)), or run the statement that may fail in a nested transaction, tx.transaction(async (inner) => …), whose failure undoes only its own work.
query.transactionRollingBack
tx.rollback() was called on this transaction, so it takes no more statements: it is being rolled back.
Return from the callback after tx.rollback(); run further statements in a new transaction.
query.transactionStreamLeftOpen
A stream on tx was still open when the transaction's callback returned, so the transaction was rolled back.
Finish the stream, or leave its for-await loop, inside the callback.
query.transactionStreamOpen
A stream is still open on this transaction's connection.
Finish it, or leave its for-await loop (break or return), before running another statement or stream.
query.tupleCompare
{op}() on a tuple takes another tuple.
Pass another tuple: tuple(a, b).{op}(tuple(x, y)).
query.tupleEmpty
tuple() needs at least one item.
Pass at least one item, as in tuple(u.lastName, u.firstName).
query.tupleLength
{op}(): the rows have {a.length} and {b.length} items.
Rows compare position by position, so give both as many items.
query.tupleNull
tuple() was given null.
A comparison with null is never true: compare the other items, and test this one with isNull().
query.tupleUndefined
tuple() was given undefined, which is not a value.
Pass a value or an expression for every item; undefined is usually a missing property or variable.
query.tupleUntyped
{op}(): position {…} of the rows has no type on either side, so the database would compare it as text.
Put a column there, or give one value a type: val(value, t.integer()).
query.undefinedOperand
{method}() was given undefined, which is not a value.
Pass a value; undefined is usually a missing property or variable.
query.undefinedOperandNullable
{method}() was given undefined, which is not a value.
Pass null for SQL NULL; undefined is usually a missing property or variable.
query.uniqueAsyncFields
validateUniqueAsync() takes a field name or a non-empty list of them.
Pass a field name or a non-empty list of them, as in validateUniqueAsync("email", repo).
query.uniqueAsyncSchemaless
validateUniqueAsync(): this changeset has no schema class, so there is no table to look in.
Make the changeset from a schema class or a row to check uniqueness in its table.
query.uniqueAsyncUnavailable
validateUniqueAsync() needs the repo's write support, which is not available in this build.
Import validateUniqueAsync's support with the repo: it is set when egon-orm's repo module is loaded.
query.uniqueFields
uniqueConstraint() takes a field name or a non-empty list of them.
Pass a field name or a non-empty list of them, as in uniqueConstraint(["email"]).
query.unknownBinding
The column {alias}.{String(node.field)} refers to the binding "{alias}", which the query does not have.
Use a binding of this query, or outerRef(alias, Schema) for one of an enclosing query.
query.unsupportedFeature
{feature} is not supported by {dialect.name}.
See Dialect support for what {dialect} supports; a fragment can write SQL the builder has no method for.
query.untypedArithmetic
Arithmetic ({op}()) on values without a type, where nothing gives them one, so the database cannot choose an operator.
Give a value a type: val(value, t.integer()) or val(value, t.float()).
query.untypedValue
A value without a type is in {where}, where nothing gives it one, so the database would return it as text. It is {typeHint(value)}.
Give the value a type with val(value, t.integer()) (or the type it has), or compare it with a column, which gives it the column's type.
query.updateAllArgument
repo.updateAll() takes a query with .set(...)
Pass a query with .set(...): repo.updateAll(from(Post, "p").where(…).set({ published: true })).
query.updateAllNoSet
repo.updateAll() needs a query with .set(...)
Say what to write with .set(...): repo.updateAll(from(Post, "p").where(…).set({ published: true })).
query.updateAllWithoutSet
updateAll needs set(…) assignments.
Say what to update with set(…): repo.updateAll(from(Post, "p").set({ published: true })).
query.updateNoKey
A row update needs at least one field to find the row by.
The update plan is malformed: the repo always finds the row by its primary key.
query.updateNoSet
A row update needs at least one field to set.
The update plan is malformed: the repo runs no statement for a changeset without changes.
query.updateWithAll
A query with set(…) assignments, an update, was run as a read.
Run it with repo.updateAll(q), or leave out set(…) to read.
query.upsertUnreadable
The upsert into {schemaMeta.name} met a row that could not be read back by the key it was given: the conflict was on another unique field, and {core.adapter.dialect} does not report which row it updated.
Nothing was written. Upsert by the key, or read the row by the conflicting field and update it.
query.valUndefined
val() was given undefined.
Pass a value, or null.
query.validateApply
{fn}(): apply must be true or false.
Pass apply: true or false, or leave it out.
query.validateApplyCombined
{fn}(): apply cannot be combined with {…}.
A schema that reports an issue has no output to apply, even when that issue is then left out. Validate with a schema of just the fields to transform instead.
query.validateApplyFunction
{fn}(): apply needs a Standard Schema, whose output is written back.
A validator function returns issues only; change values with putChange.
query.validateChangeFunction
validateChange() takes a function.
Pass a function of the field's change, as in validateChange("email", (value) => …).
query.validateChangeResult
A validateChange() function must return a message, an error ({ message, meta? }), a list of either, or nothing.
Return a message, an error ({ message, meta? }), a list of either, or nothing from the function.
query.validateOnly
{fn}(): only must be a list of field names.
Pass only as a list of field names, as in { only: ["email"] }.
query.validateOptions
{fn}(): the options must be an object.
Pass the options as an object, such as { scope: "changed" }.
query.validateScope
{fn}(): scope must be "all" or "changed".
Pass scope: "all" (the default) or "changed".
query.validateUnknownField
{fn}(): "{name}" is not a field. The fields are: {[...fields.keys()].join(", ")}.
Name one of the changeset's fields; a typo is the usual cause.
query.validatorPromise
The validator returned a Promise.
An async validator runs with validateAsync(); validate() is synchronous.
query.validatorValueType
{fn}(): the change of "{field}" is not {expected}, so it cannot be validated this way.
Use the validator on a field of the matching type, or validate the value with validateChange().
query.valuesEmpty
The values source "{node.alias}" has no rows.
Give the values source at least one row.
query.valuesRowLength
Row {r} of the values source "{node.alias}" does not have one value per column.
Give every row one value per column.
query.windowArgument
{method}() takes an expression.
Pass an expression, such as p.views.
query.windowCallback
windows({ {name} }) takes a callback that receives the bindings and returns the window.
Pass a callback that receives the bindings and returns the window: {name}: ({ p }) => ({ partitionBy: [p.authorId] }).
query.windowCount
{method}() takes {what} as a whole number of at least 1, or an integer expression; it was given {…}.
Pass {what} as a whole number of at least 1, or an integer expression.
query.windowFrame
{where}: frame is a fragment.
Pass a fragment, such as fragment`rows between unbounded preceding and current row`.
query.windowFunctionFilter
{clause}(): {node.name}() is a window function, which takes no filter().
filter() is for aggregates such as count() and sum(); remove it from the window function.
query.windowFunctionOver
{clause}(): {node.name}() is a window function and needs a window.
Add .over(…), such as {name}().over({ orderBy: [p.createdAt] }).
query.windowInClause
{clause}(): {what}, which cannot be used in {clause}().
Window functions are allowed only in select() and orderBy().
query.windowInFilter
{clause}(): {what}, which cannot be used in {clause}().
Window functions are computed after the rows are filtered and grouped. Select it, then filter on it from a query over this one: from(subquery(q), "s").where(…).
query.windowMemberArray
{where}: {member} is not an array.
Pass an array: {member}: [p.authorId].
query.windowName
windows() was given the name "{name}".
Give each window a name that is an identifier: a letter or underscore, then letters, digits, underscores or $.
query.windowOrder
{where}: orderBy holds something that is not an expression or an order item.
Put expressions or order items in orderBy, as in orderBy: [p.createdAt.desc()].
query.windowPartition
{where}: partitionBy holds something that is not an expression.
Put expressions in partitionBy, as in partitionBy: [p.authorId].
query.windowShape
{where}: the callback must return a window.
Return a window from the callback: { partitionBy, orderBy, frame }.
query.windowTwice
windows() declares "{name}", which this query already declares.
Give each window its own name.
query.windowUndeclared
{clause}(): over("{over}") names a window this query does not declare{…}.
Declare it first: windows({ {over}: ({ p }) => ({ … }) }).
query.windowUnknownKey
{where}: a window has no {extra.map((key) => `"${key}"`).join(", ")}.
A window takes partitionBy, orderBy and frame.
query.windowsEmpty
windows() was given no window.
Name at least one window: windows({ w: ({ p }) => ({ partitionBy: [p.authorId] }) }).
query.windowsObject
windows() takes an object of named windows.
Pass an object of named windows: windows({ w: ({ p }) => ({ partitionBy: [p.authorId] }) }).
query.withCteQuery
withCte({…}, query) takes a query as its second argument.
Pass a query built with from() as the second argument: withCte("tree", from(Category, "c")).
query.writeEmbedded
{meta.name} is an embedded schema: it has no table to write to.
Write the parent row, whose column holds the embedded value.
query.writeEmbeddedSchema
{schemaMeta.name} is an embedded schema: it is stored inside its parent's row and has no table to write to.
Write the parent row, whose column holds the embedded value.
query.writeJoinKind
{verb} can join only with join() or crossJoin(); a {node.type} join has no meaning there.
Join with join() (an inner join) or crossJoin() in an update or a delete.
query.writeNestedNotEmbed
repo.{method}(): the changeset of {schemaMeta.name} holds a changeset as the change of "{key}", which is not an embed field.
Only embed fields and associations hold nested changesets.
query.writeNewRecord
repo.{method}() needs a changeset of a loaded row; this one is of a new {schemaMeta.name} (made from the class).
Insert it with repo.insert(), or use repo.insertOrUpdate().
query.writeNoKeyValue
repo.{method}(): the {schemaMeta.name} row has no value for its key field "{field.name}".
Pass a changeset of a row read from the database, which has its key.
query.writeNoPrimaryKey
repo.{method}(): {schemaMeta.name} has no primary key, so a row of it cannot be found again to {…}.
Use repo.{method}() with a query.
query.writeNotLoaded
repo.{method}() needs a row read from the database; {…}.
Pass a changeset of a row returned by a query or a write that was not deleted.
query.writeNotWholeNumber
The value written to {field} holds a number that is not a whole number where {wholeTypeName(slot)} is expected.
Give it a whole number, or declare the field t.float() or t.decimal() if it holds fractions.
query.writeOptionField
{where}: {…} is not {…} of {schemaMeta.name}. Its fields are: {…}.
Name stored fields of the schema.
query.writeOptionFields
{where} must be a non-empty list of field names.
Pass a non-empty list of field names, as in ["email"].
query.writeSchemaless
repo.{method}(): this changeset has no schema class (it was cast from { data, types }), so it has no table to write to.
Use applyAction() to validate such data.
query.writeUnknownChange
repo.{method}(): the changeset holds a change of "{key}", which is neither a field nor an association of {schemaMeta.name}.
Change only the fields and associations the schema declares; a changeset built with cast() or change() never holds others.
query.writeUnknownField
{what} holds a field that is not a field of {meta.name}.
The write plan is malformed: the repo passes only the schema's own fields.
query.writeVirtualField
{what} holds the virtual field {meta.name}.{field.name}, which has no column.
The write plan is malformed: the repo never writes a virtual field.
query.writeWithClause
{verb} cannot run a query with {clause}.
Remove {clause} from the query before {verb}: exclude() removes a clause.
query.zodFieldList
toZod(): {option} must be a list of field names.
Pass a list of field names, as in { pick: ["email", "name"] }.
query.zodHint
toZod(): the zod hint of the type "{type.name}" is not a Zod schema (or a function returning one).
Give the type a zod hint that is a Zod schema, or a function of the field that returns one.
query.zodMode
toZod(): mode must be "row", "insert" or "update".
Pass mode: "row" (the default), "insert" or "update".
query.zodUnknownField
toZod(): {option} names {…}, which is not one of the fields: {[...allowed].join(", ")}.
Name only fields of the schema.

