mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Allow forcing nullness of columns during bootstrap.
Bootstrap determines whether a column is null based on simple builtin rules. Those work surprisingly well, but nonetheless a few existing columns aren't set correctly. Additionally there is at least one patch sent to hackers where forcing the nullness of a column would be helpful. The boostrap format has gained FORCE [NOT] NULL for this, which will be emitted by genbki.pl when BKI_FORCE_(NOT_)?NULL is specified for a column in a catalog header. This patch doesn't change the marking of any existing columns. Discussion: 20150215170014.GE15326@awork2.anarazel.de
This commit is contained in:
@@ -161,7 +161,8 @@ sub Catalogs
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($atttype, $attname) = split /\s+/, $_;
|
||||
my %row;
|
||||
my ($atttype, $attname, $attopt) = split /\s+/, $_;
|
||||
die "parse error ($input_file)" unless $attname;
|
||||
if (exists $RENAME_ATTTYPE{$atttype})
|
||||
{
|
||||
@@ -172,7 +173,26 @@ sub Catalogs
|
||||
$attname = $1;
|
||||
$atttype .= '[]'; # variable-length only
|
||||
}
|
||||
push @{ $catalog{columns} }, { $attname => $atttype };
|
||||
|
||||
$row{'type'} = $atttype;
|
||||
$row{'name'} = $attname;
|
||||
|
||||
if (defined $attopt)
|
||||
{
|
||||
if ($attopt eq 'PG_FORCE_NULL')
|
||||
{
|
||||
$row{'forcenull'} = 1;
|
||||
}
|
||||
elsif ($attopt eq 'BKI_FORCE_NOT_NULL')
|
||||
{
|
||||
$row{'forcenotnull'} = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "unknown column option $attopt on column $attname"
|
||||
}
|
||||
}
|
||||
push @{ $catalog{columns} }, \%row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user