Load more records, but not some odd "No title" records.

This commit is contained in:
barnold 2022-10-12 19:10:07 +01:00
parent 847da3ba3b
commit 1749e2b1c1
2 changed files with 4 additions and 2 deletions

View File

@ -106,9 +106,11 @@ while (my $row = $sth_csv->fetchrow_arrayref) {
next if (1 == $rowcount); # It ignores skip_first_row so DIY.
my ($pgid, $title, $auth) = @$row;
# Discard what we deem excessively long.
if (length($title) > 128 || length($auth) > 64) {
if (length($title) > 128 || length($auth) > 128) {
next;
}
# Discard the weird 'No title' records.
next if ($title eq 'No title');
# Some titles contain a newline. Turn occurrences of one or more
# whitespace characters into a single space.
$title =~ s/\s+/ /g;

View File

@ -1,7 +1,7 @@
CREATE TABLE author
( id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
when_created TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
name VARCHAR(64) NOT NULL CONSTRAINT author_name_unique UNIQUE
name VARCHAR(128) NOT NULL CONSTRAINT author_name_unique UNIQUE
);
CREATE TABLE book