Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert Default #223

Merged
merged 5 commits into from
Feb 6, 2022
Merged

Insert Default #223

merged 5 commits into from
Feb 6, 2022

Conversation

@billy1624 billy1624 self-assigned this Jan 6, 2022
Breaking Changes:
- `InsertStatement::exprs` method skip pushing empty values row into vector
@tyt2y3 tyt2y3 changed the base branch from master to pull/223 February 6, 2022 07:47
@tyt2y3 tyt2y3 merged commit 2678211 into pull/223 Feb 6, 2022
@tyt2y3 tyt2y3 deleted the insert-default-values branch February 6, 2022 07:47
tyt2y3 added a commit that referenced this pull request Feb 6, 2022
@tyt2y3
Copy link
Member

tyt2y3 commented Feb 6, 2022

I totally think that the above API behaviour is too smart, the following should be better.
There is no basis that the query builder just assumes that DEFAULT VALUES is valid for the table either.

assert_eq!(
    Query::insert()
        .into_table(Glyph::Table)
        .or_default_values()
        .to_string(PostgresQueryBuilder),
    "INSERT INTO \"glyph\" DEFAULT VALUES"
);
assert_eq!(
    Query::insert()
        .into_table(Glyph::Table)
        .columns(vec![Glyph::Image])
        .values_panic(vec!["ABC".into()])
        .or_default_values()
        .to_string(PostgresQueryBuilder),
    "INSERT INTO \"glyph\" (\"image\") VALUES ('ABC')"
);

tyt2y3 added a commit that referenced this pull request Feb 26, 2022
This reverts commit f60ee3a, reversing
changes made to 81285b9.
@billy1624 billy1624 mentioned this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants