# this one could be more complicated, need to set a DEFAULT value and update
# the table first...
if ( $self->null && ! $new->null ) {
- push @r, "ALTER TABLE $table ALTER COLUMN $name SET NOT NULL";
+
+ if ( $driver eq 'Pg' && $dbh->{'pg_server_version'} < 70300 ) {
+ push @r, "UPDATE pg_attribute SET attnotnull = TRUE
+ WHERE attname = '$name'
+ AND attrelid = ( SELECT oid FROM pg_class
+ WHERE relname = '$table'
+ )";
+ } else {
+ push @r, "ALTER TABLE $table ALTER COLUMN $name SET NOT NULL";
+ }
}
# change other stuff...