SQL::Tr...stgreSQL(3)
π NAME π
SQL::Translator::Parser::PostgreSQL β bestie, it's the parser for PostgreSQL β¨ (that's it, that's the whole vibe check).
β¨ SYNOPSIS β¨
Okay so here's how you summon it, no cap:
use SQL::Translator;
use SQL::Translator::Parser::PostgreSQL;
my $translator = SQL::Translator->new;
$translator->parser("SQL::Translator::Parser::PostgreSQL");
That's literally all you need to get it going π«Ά
πΈ DESCRIPTION πΈ
So the tea is: this grammar was started from the MySQL parsers π. And here's the description straight from PostgreSQL, truncated to what's currently supported β and yes, patches are welcome, of course ππ :
Table: (http://www.postgresql.org/docs/current/sql-createtable.html)
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 ]
Index : (http://www.postgresql.org/docs/current/sql-createindex.html)
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 ]
Alter table:
ALTER TABLE [ ONLY ] table [ * ]
ADD [ COLUMN ] column type [ column_constraint [ ... ] ]
ALTER TABLE [ ONLY ] table [ * ]
ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT }
ALTER TABLE [ ONLY ] table [ * ]
ALTER [ COLUMN ] column SET STATISTICS integer
ALTER TABLE [ ONLY ] table [ * ]
RENAME [ COLUMN ] column TO newcolumn
ALTER TABLE table
RENAME TO new_table
ALTER TABLE table
ADD table_constraint_definition
ALTER TABLE [ ONLY ] table
DROP CONSTRAINT constraint { RESTRICT | CASCADE }
ALTER TABLE table
OWNER TO new_owner
View :
CREATE [ OR REPLACE ] VIEW view [ ( column name list ) ] AS SELECT query
Lowkey important: this is the truncated version of what PostgreSQL actually supports. So if your fave syntax isn't in here, that's why β not me being shady π
π AUTHORS π
The icons who made this happen: Ken Y. Clark <kclark@cpan.org>, and Allen Day <allenday@ucla.edu>. Periodt π
π¦ SEE ALSO π¦
perl(1)Parse::RecDescent
β¨ that's the whole page bestie, go parse some PostgreSQL β¨
This little masterpiece is from perl v5.42.0, dated 2024-12-12 β SQL::Tr...stgreSQL(3), mwah ππ
π¦ where this page comes from
- opensuse-leap 16.0: perl-SQL-Translator 1.660.0-bp160.1.11 Β· (Artistic-1.0 OR GPL-1.0-or-later) AND GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms