Structure
SQLExcludedColumn
An expression appearing on the right side of a column assignment which, when the assignment list is part of an upsert’s update acion, refers to the value which was originally to be inserted for the given column.
struct SQLExcludedColumn
Overview
Note
If the serializer’s dialect does not support upserts, this expression silently evaluates to nothing at all.
Warning
At the time of this writing, MySQL 8.0’s recommended “table alias” syntax for excluded columns is not implemented, due to there currently being no way for a SQLDialect to vary its contents based on the database server version (for that matter, we don’t even have support for retrieving the version from MySQLNIO). For now, the deprecated VALUES() function is used unconditionally, which will throw warnings starting from MySQL 8.0.20. If this affects your usage, use a raw query or manually construct the necessary expressions to specify and use the alias for now.
Topics
Initializers
init(_:)Create an excluded column specifier.
Instance Properties
var name: any SQLExpressionThe excluded column’s name.
Instance Methods
func serialize(to: inout SQLSerializer)Invoked when a request is made to serialize the expression to raw SQL.
Relationships
Conforms To
SQLExpressionSwift.SendableSwift.SendableMetatype
See Also
Clause Expressions
struct SQLAlterColumnDefinitionTypeA clause specifying a new data type to be applied to an existing column.struct SQLColumnAssignmentEncapsulates acolumn_name=valueexpression in the context of anUPDATEquery’s value assignment list. This is distinct from anSQLBinaryExpressionusing the.equaloperator in that the left side must be an unqualified column name, the operator must be=, and the right side may useSQLExcludedColumnwhen the assignment appears in theassignmentslist of aSQLConflictAction.update(assignments:predicate:)specification.enum SQLColumnConstraintAlgorithmColumn-level data constraints.struct SQLColumnDefinitionA clause expressing a column definition, for use when creating and altering tables.struct SQLCommonTableExpressionA clause describing a single Common Table Expressions, which in itws simplest form provides additional data to a primary query in the same way as joining to a subquery.struct SQLCommonTableExpressionGroupA clause representing a group of one or moreSQLCommonTableExpressions.enum SQLConflictActionAn action to take when anINSERTquery encounters a unique constraint violation.struct SQLConflictResolutionStrategySpecifies a conflict resolution strategy and associated conditions for anINSERTquery. AnINSERTwith a conflict strategy is often refered to as anUPSERT(“insert or update”). Databases are not required to support any given subset of upsert functionality, or any at all.enum SQLDropBehaviorSpecifies a behavior when performing aDROPoperation on a database object which is referenced by other objects.struct SQLEnumDataTypeRepresents a data type which specifies an enumeration in the database.struct SQLForeignKeyA completeFOREIGN KEYconstraint specification.struct SQLInsertModifierSimple helper for working around MySQL’s refusal to implement standard SQL. Only emits SQL when needed.struct SQLJoinEncapsulates a single SQLJOIN, specifying the join type, the right-side table, and condition.enum SQLJoinMethodThe method used by a table join clause.enum SQLLockingClauseAn SQL locking clause.