-
-
Notifications
You must be signed in to change notification settings - Fork 17
Consider platform integer size in ColumnBuilder::bigint() + Throw exception on "unsigned" column usage
#460
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,12 @@ | |
| return $column; | ||
| } | ||
|
|
||
| public function fromPseudoType(string $pseudoType, array $info = []): ColumnInterface | ||
| { | ||
| // PostgreSQL doesn't support unsigned types | ||
| return parent::fromPseudoType($pseudoType, $info)->unsigned(false); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think that this is correct. There are ways how to get unsigned type (with check)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsigned in most cases (almost always?) is added for store big values, not for non-negative values constraint. |
||
| } | ||
|
|
||
| protected function columnDefinitionParser(): ColumnDefinitionParser | ||
| { | ||
| return new ColumnDefinitionParser(); | ||
|
|
@@ -133,7 +139,7 @@ | |
| $value = preg_replace("/::[^:']+$/", '$1', $defaultValue); | ||
|
|
||
| if (str_starts_with($value, "B'") && $value[-1] === "'") { | ||
| return $column->phpTypecast(substr($value, 2, -1)); | ||
|
Check warning on line 142 in src/Column/ColumnFactory.php
|
||
| } | ||
|
|
||
| $value = parent::normalizeNotNullDefaultValue($value, $column); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just ignore this. Or as an option we can add
CHECK (column >= 0)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsigned columns often usage for big values. Exception will alert the user that this is not available.