Insert values except / merge
enhancement
I'd like do be able to structure a query like:
```sql
INSERT INTO <table>
VALUES <values> EXCEPT
SELECT <cols> FROM <table>
```
There might be a way to do this that I'm not sure of but some of the directions I went down were:
```swift
db.insert(into: <table>).values(...).except(...) // Not an API
db.insert(into: <table>).select(SQLSubQuery.select({
$0.values(...).union(...) // Not an API
}))
db.insert(into: <table>).select(SQLSubQuery.except({
$0.values(...)
}).except(...) // Not an API
)
```
Context: My ultimate objective is to perform a [merge](https://www.postgresql.org/docs/current/sql-merge.html) but I know that is not general SQL so I'm trying to get as close an approximation I can with a single query.
3 条评论