Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sqlserver2pgsql.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,10 @@ sub parse_dump
{
$constraint->{ON_UPD_CASC} = 1;
}
elsif ($fk =~ /^ON UPDATE SET NULL\s*$/)
{
$constraint->{ON_UPD_SET_NULL} = 1;
}
elsif ($fk =~ /^NOT FOR REPLICATION\s*$/)
{
next; # We don't care for this, it has no meaning for PostgreSQL
Expand Down Expand Up @@ -2817,6 +2821,11 @@ sub generate_schema
{
$consdef .= " ON UPDATE CASCADE";
}
if (defined $constraint->{ON_UPD_SET_NULL}
and $constraint->{ON_UPD_SET_NULL})
{
$consdef .= " ON UPDATE SET NULL";
}
# We need a name on the constraint to be able to validate it later. Maybe it would be better to generate one
# FIXME: we'll see later if a generator is needed (probably)
if ($constraint->{TYPE} eq 'FK' and ($validate_constraints =~ /^after|no$/) and defined($constraint->{NAME}))
Expand Down