package SQL::Translator::Producer::PostgreSQL;
# -------------------------------------------------------------------
-# $Id: PostgreSQL.pm,v 1.18 2003-09-26 22:48:53 kycl4rk Exp $
+# $Id: PostgreSQL.pm,v 1.22 2004-02-09 23:02:15 kycl4rk Exp $
# -------------------------------------------------------------------
-# Copyright (C) 2003 Ken Y. Clark <kclark@cpan.org>,
-# darren chamberlain <darren@cpan.org>,
-# Chris Mungall <cjm@fruitfly.org>
+# Copyright (C) 2002-4 SQLFairy Authors
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
SQL::Translator::Producer::PostgreSQL - PostgreSQL producer for SQL::Translator
+=head1 SYNOPSIS
+
+ my $t = SQL::Translator->new( parser => '...', producer => 'PostgreSQL' );
+ $t->translate;
+
+=head1 DESCRIPTION
+
+Creates a DDL suitable for PostgreSQL. Very heavily based on the Oracle
+producer.
+
=cut
use strict;
use vars qw[ $DEBUG $WARN $VERSION ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.18 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.22 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 1 unless defined $DEBUG;
use SQL::Translator::Schema::Constants;
UNION UNIQUE USER USING VERBOSE WHEN WHERE
];
-my $max_id_length = 30;
+my $max_id_length = 62;
my %used_identifiers = ();
my %global_names;
my %unreserve;
);
}
- $output .= join( "\n\n", @fks );
+ if ( @fks ) {
+ $output .= "--\n-- Foreign Key Definitions\n--\n\n" unless $no_comments;
+ $output .= join( "\n\n", @fks );
+ }
if ( $WARN ) {
if ( %truncated ) {
=pod
+=head1 SEE ALSO
+
+SQL::Translator, SQL::Translator::Producer::Oracle.
+
=head1 AUTHOR
-Ken Y. Clark E<lt>kclark@cpan.orgE<gt>
+Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
=cut