1SQL::Translator::ProducUesre:r:PCoosnttgrriebSuQtLe(d3S)PQeLr:l:TDroacnusmleanttoart:i:oPnroducer::PostgreSQL(3)
2
3
4

NAME

6       SQL::Translator::Producer::PostgreSQL - PostgreSQL producer for
7       SQL::Translator
8

SYNOPSIS

10         my $t = SQL::Translator->new( parser => '...', producer => 'PostgreSQL' );
11         $t->translate;
12

DESCRIPTION

14       Creates a DDL suitable for PostgreSQL.  Very heavily based on the
15       Oracle producer.
16
17       Now handles PostGIS Geometry and Geography data types on table
18       definitions.  Does not yet support PostGIS Views.
19
20   Producer Args
21       You can change the global behavior of the producer by passing the
22       following options to the "producer_args" attribute of
23       "SQL::Translator".
24
25       postgres_version
26           The version of postgres to generate DDL for. Turns on features only
27           available in later versions. The following features are supported
28
29           IF EXISTS
30               If your postgres_version is higher than 8.003 (I should hope it
31               is by now), then the DDL generated for dropping objects in the
32               database will contain IF EXISTS.
33
34       attach_comments
35           Generates table and column comments via the COMMENT command rather
36           than as a comment in the DDL. You could then look it up with \dt+
37           or \d+ (for tables and columns respectively) in psql. The comment
38           is dollar quoted with $comment$ so you can include ' in it. Just to
39           clarify: you get this
40
41               CREATE TABLE foo ...;
42               COMMENT on TABLE foo IS $comment$hi there$comment$;
43
44           instead of this
45
46               -- comment
47               CREAT TABLE foo ...;
48
49   Extra args
50       Various schema types support various options via the "extra" attribute.
51
52       Tables
53         temporary
54           Produces a temporary table.
55
56       Views
57         temporary
58           Produces a temporary view.
59
60         materialized
61           Produces a materialized view.
62
63       Fields
64         list, custom_type_name
65           For enum types, list is the list of valid values, and
66           custom_type_name is the name that the type should have. Defaults to
67           $table_$field_type.
68
69         geometry_type, srid, dimensions, geography_type
70           Fields for use with PostGIS types.
71

PostgreSQL Create Table Syntax

73         CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name (
74             { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ]
75             | table_constraint }  [, ... ]
76         )
77         [ INHERITS ( parent_table [, ... ] ) ]
78         [ WITH OIDS | WITHOUT OIDS ]
79
80       where column_constraint is:
81
82         [ CONSTRAINT constraint_name ]
83         { NOT NULL | NULL | UNIQUE | PRIMARY KEY |
84           CHECK (expression) |
85           REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ]
86             [ ON DELETE action ] [ ON UPDATE action ] }
87         [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
88
89       and table_constraint is:
90
91         [ CONSTRAINT constraint_name ]
92         { UNIQUE ( column_name [, ... ] ) |
93           PRIMARY KEY ( column_name [, ... ] ) |
94           CHECK ( expression ) |
95           FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
96             [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] }
97         [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
98

Create Index Syntax

100         CREATE [ UNIQUE ] INDEX index_name ON table
101             [ USING acc_method ] ( column [ ops_name ] [, ...] )
102             [ INCLUDE  ( column [, ...] ) ]
103             [ WHERE predicate ]
104         CREATE [ UNIQUE ] INDEX index_name ON table
105             [ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] )
106             [ WHERE predicate ]
107

SEE ALSO

109       SQL::Translator, SQL::Translator::Producer::Oracle.
110

AUTHOR

112       Ken Youens-Clark <kclark@cpan.org>.
113
114
115
116perl v5.36.0                      2023-S0Q2L-:2:7Translator::Producer::PostgreSQL(3)
Impressum