Skip Menu |

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 68701
Status: resolved
Priority: 0/
Queue: SQL-Translator

People
Owner: Nobody in particular
Requestors: ATRODO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.11008
Fixed in: 0.11011



Subject: PATCH: PostgreSQL adding foreign key doesn't name the constraint
The producer for PostgreSQL does not name foreign keys, even though it is already generated. Attached is a patch that adds $def_start to the alter statement.
Subject: patch0.patch
--- a/lib/perl5/SQL/Translator/Producer/PostgreSQL.pm +++ b/lib/perl5/SQL/Translator/Producer/PostgreSQL.pm @@ -675,7 +675,7 @@ sub create_constraint push @constraint_defs, "${def_start}CHECK ($expression)"; } elsif ( $c->type eq FOREIGN_KEY ) { - my $def .= "ALTER TABLE ${qt}${table_name}${qt} ADD FOREIGN KEY (" . + my $def .= "ALTER TABLE ${qt}${table_name}${qt} ADD ${def_start}FOREIGN KEY (" . join( ', ', map { qq[$qf$_$qf] } @fields ) . ')' . "\n REFERENCES " . $qt . $c->reference_table . $qt;
This was fixed in v0.11011.