SQL::Translator::Producer::PostgreSQL(3pm) | User Contributed Perl Documentation | SQL::Translator::Producer::PostgreSQL(3pm) |
SQL::Translator::Producer::PostgreSQL - PostgreSQL producer for SQL::Translator
my $t = SQL::Translator->new( parser => '...', producer => 'PostgreSQL' ); $t->translate;
Creates a DDL suitable for PostgreSQL. Very heavily based on the Oracle producer.
Now handles PostGIS Geometry and Geography data types on table definitions. Does not yet support PostGIS Views.
You can change the global behavior of the producer by passing the following options to the "producer_args" attribute of "SQL::Translator".
CREATE TABLE foo ...; COMMENT on TABLE foo IS $comment$hi there$comment$;
instead of this
-- comment CREAT TABLE foo ...;
Various schema types support various options via the "extra" attribute.
CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ] | table_constraint } [, ... ] ) [ INHERITS ( parent_table [, ... ] ) ] [ WITH OIDS | WITHOUT OIDS ]
where column_constraint is:
[ CONSTRAINT constraint_name ] { NOT NULL | NULL | UNIQUE | PRIMARY KEY | CHECK (expression) | REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
and table_constraint is:
[ CONSTRAINT constraint_name ] { UNIQUE ( column_name [, ... ] ) | PRIMARY KEY ( column_name [, ... ] ) | CHECK ( expression ) | EXCLUDE [USING acc_method] (expression) [INCLUDE (column [, ...])] [WHERE (predicate)] FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ] [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
CREATE [ UNIQUE ] INDEX index_name ON table [ USING acc_method ] ( column [ ops_name ] [, ...] ) [ INCLUDE ( column [, ...] ) ] [ WHERE predicate ] CREATE [ UNIQUE ] INDEX index_name ON table [ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] ) [ WHERE predicate ]
SQL::Translator, SQL::Translator::Producer::Oracle.
Ken Youens-Clark <kclark@cpan.org>.
2024-01-20 | perl v5.38.2 |