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

Fix fallout from STRICT_TRANS_TABLES being on by default #147

Closed
notartom opened this issue Nov 29, 2022 · 0 comments
Closed

Fix fallout from STRICT_TRANS_TABLES being on by default #147

notartom opened this issue Nov 29, 2022 · 0 comments

Comments

@notartom
Copy link
Member

notartom commented Nov 29, 2022

With the move to Jammy, MariaDB gets STRICT_TRANS_TABLES on by default. This means that we need to be more careful around how we insert/update values. See for example c79a69d, wherein we can no longer insert the empty string into an integer column and have it get magically converted to the default 0, which I assume is what was happening before.

If we're ever inserting without specifying a value for a column, it needs to be declared as having a default (NULL), and since no automagic truncation is happening, we need to make sure our data can fit in our fields.

CREATE TABLE `form_generators` (
  <snip>
  `link_to_auth` varchar(255) NOT NULL,
  <snip>
) ENGINE=InnoDB AUTO_INCREMENT=13122 DEFAULT CHARSET=utf8mb3

So once the update is complete, but before we go live, we'll need to:

alter table form_generators modify column link_to_auth varchar(255) null;
alter table form_generators modify column pub_year int(4) null;
alter table search_table modify column section_reader_id int(11) null;
alter table search_table modify column search_field varchar(510) not null;
alter table users alter column max_projects set default 0;

update users set ip_address=0;
alter table users modify ip_address varchar(45) not null;
update users set ip_address='127.0.0.1' where ip_address='0';
@notartom notartom changed the title Make form_generators.link_to_auth nullable Make columns nullable Nov 29, 2022
notartom added a commit to notartom/librivox-catalog that referenced this issue Nov 29, 2022
With the move to Jammy, MariaDB now has STRICT_TRANS_TABLES on by
default. This means we can no longer do things like save empty strings
into integer columns and have them magically transformed into the
correct type (which I assume is what was happening before). This patch
adds a bunch of code around places where such slopiness was detected
during testing. The patch is half of the fix, the other half is
issue LibriVox#147.
notartom added a commit to notartom/librivox-catalog that referenced this issue Dec 2, 2022
With the move to Jammy, MariaDB now has STRICT_TRANS_TABLES on by
default. This means we can no longer do things like save empty strings
into integer columns and have them magically transformed into the
correct type (which I assume is what was happening before). This patch
adds a bunch of code around places where such slopiness was detected
during testing. The patch is half of the fix, the other half is
issues LibriVox#147 and LibriVox#148.
notartom added a commit to notartom/librivox-catalog that referenced this issue Dec 2, 2022
With the move to Jammy, MariaDB now has STRICT_TRANS_TABLES on by
default. This means we can no longer do things like save empty strings
into integer columns and have them magically transformed into the
correct type (which I assume is what was happening before). This patch
adds a bunch of code around places where such slopiness was detected
during testing. The patch is half of the fix, the other half is
issues LibriVox#147 and LibriVox#148.
notartom added a commit that referenced this issue Dec 2, 2022
With the move to Jammy, MariaDB now has STRICT_TRANS_TABLES on by
default. This means we can no longer do things like save empty strings
into integer columns and have them magically transformed into the
correct type (which I assume is what was happening before). This patch
adds a bunch of code around places where such slopiness was detected
during testing. The patch is half of the fix, the other half is
issues #147 and #148.
@notartom notartom changed the title Make columns nullable Fix fallout from STRICT_TRANS_TABLES being on by default Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant