73 lines
1.8 KiB
Markdown
73 lines
1.8 KiB
Markdown
## Release Notes: sea-query 1.0.0-rc.31
|
|
|
|
*(since 1.0.0-rc.30)*
|
|
|
|
### New Features
|
|
|
|
* Implement `SELECT INTO` for Postgres
|
|
|
|
```rust
|
|
let query = Query::select()
|
|
.from(Char::Table)
|
|
.column(Char::Character)
|
|
.into_table(SelectInto::table("character_copy").modifier(SelectIntoTableModifier::Unlogged))
|
|
.to_owned();
|
|
|
|
assert_eq!(
|
|
query.to_string(PostgresQueryBuilder),
|
|
r#"SELECT "character" INTO UNLOGGED TABLE "character_copy" FROM "character""#
|
|
);
|
|
|
|
let query = Query::select()
|
|
.from(Char::Table)
|
|
.column(Char::Character)
|
|
.into_table(SelectInto::table("character_temp").modifier(SelectIntoTableModifier::Temporary))
|
|
.to_owned();
|
|
|
|
assert_eq!(
|
|
query.to_string(PostgresQueryBuilder),
|
|
r#"SELECT "character" INTO TEMPORARY TABLE "character_temp" FROM "character""#
|
|
);
|
|
```
|
|
|
|
* Add `Expr::eq_any` and `Expr::ne_all` (Postgres, requires `postgres-array` feature)
|
|
|
|
```rust
|
|
let query = Query::select()
|
|
.columns([Char::Id])
|
|
.from(Char::Table)
|
|
.and_where(
|
|
(Char::Table, Char::SizeW)
|
|
.into_column_ref()
|
|
.eq_any([1, 2, 3]),
|
|
)
|
|
.to_owned();
|
|
|
|
assert_eq!(
|
|
query.to_string(PostgresQueryBuilder),
|
|
r#"SELECT "id" FROM "character" WHERE "character"."size_w" = ANY(ARRAY [1,2,3])"#
|
|
);
|
|
|
|
let query = Query::select()
|
|
.columns([Char::Id])
|
|
.from(Char::Table)
|
|
.and_where(
|
|
(Char::Table, Char::SizeW)
|
|
.into_column_ref()
|
|
.ne_all([1, 2, 3]),
|
|
)
|
|
.to_owned();
|
|
|
|
assert_eq!(
|
|
query.to_string(PostgresQueryBuilder),
|
|
r#"SELECT "id" FROM "character" WHERE "character"."size_w" <> ALL(ARRAY [1,2,3])"#
|
|
);
|
|
```
|
|
|
|
* Add `Value::array_type` — returns the `ArrayType` of a `Value` without inspecting the inner value
|
|
|
|
### Bug Fixes
|
|
|
|
* Fix `GENERATED ALWAYS` clause
|
|
* Clarify default behaviour on `StringLen` — `StringLen::None` maps to `varchar(255)` on MySQL, `text` on Postgres
|