Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sql::translator::parser::postgresql(3pm) [debian man page]

SQL::Translator::Parser::PostgreSQL(3pm)		User Contributed Perl Documentation		  SQL::Translator::Parser::PostgreSQL(3pm)

NAME
SQL::Translator::Parser::PostgreSQL - parser for PostgreSQL SYNOPSIS
use SQL::Translator; use SQL::Translator::Parser::PostgreSQL; my $translator = SQL::Translator->new; $translator->parser("SQL::Translator::Parser::PostgreSQL"); DESCRIPTION
The grammar was started from the MySQL parsers. Here is the description from PostgreSQL: Table: (http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=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 ) | 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/view.php?version=7.3&idoc=1&file=sql-createindex.html) CREATE [ UNIQUE ] INDEX index_name ON table [ USING acc_method ] ( column [ ops_name ] [, ...] ) [ 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 table: CREATE [ OR REPLACE ] VIEW view [ ( column name list ) ] AS SELECT query AUTHORS
Ken Y. Clark <kclark@cpan.org>, Allen Day <allenday@ucla.edu>. SEE ALSO
perl(1), Parse::RecDescent. perl v5.14.2 2012-05-01 SQL::Translator::Parser::PostgreSQL(3pm)

Check Out this Related Man Page

ALTER FOREIGN 
TABLE(7) PostgreSQL 9.2.7 Documentation ALTER FOREIGN TABLE(7) NAME
ALTER_FOREIGN_TABLE - change the definition of a foreign table SYNOPSIS
ALTER FOREIGN TABLE [ IF EXISTS ] name action [, ... ] ALTER FOREIGN TABLE [ IF EXISTS ] name RENAME [ COLUMN ] column_name TO new_column_name ALTER FOREIGN TABLE [ IF EXISTS ] name RENAME TO new_name ALTER FOREIGN TABLE [ IF EXISTS ] name SET SCHEMA new_schema where action is one of: ADD [ COLUMN ] column_name data_type [ NULL | NOT NULL ] DROP [ COLUMN ] [ IF EXISTS ] column_name [ RESTRICT | CASCADE ] ALTER [ COLUMN ] column_name [ SET DATA ] TYPE data_type ALTER [ COLUMN ] column_name { SET | DROP } NOT NULL ALTER [ COLUMN ] column_name SET STATISTICS integer ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] ) ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] ) ALTER [ COLUMN ] column_name OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) OWNER TO new_owner OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) DESCRIPTION
ALTER FOREIGN TABLE changes the definition of an existing foreign table. There are several subforms: ADD COLUMN This form adds a new column to the foreign table, using the same syntax as CREATE FOREIGN TABLE (CREATE_FOREIGN_TABLE(7)). DROP COLUMN [ IF EXISTS ] This form drops a column from a foreign table. You will need to say CASCADE if anything outside the table depends on the column; for example, views. If IF EXISTS is specified and the column does not exist, no error is thrown. In this case a notice is issued instead. IF EXISTS Do not throw an error if the foreign table does not exist. A notice is issued in this case. SET DATA TYPE This form changes the type of a column of a foreign table. SET/DROP NOT NULL Mark a column as allowing, or not allowing, null values. SET STATISTICS This form sets the per-column statistics-gathering target for subsequent ANALYZE(7) operations. See the similar form of ALTER TABLE (ALTER_TABLE(7)) for more details. SET ( attribute_option = value [, ... ] ), RESET ( attribute_option [, ... ] ) This form sets or resets per-attribute options. See the similar form of ALTER TABLE (ALTER_TABLE(7)) for more details. OWNER This form changes the owner of the foreign table to the specified user. RENAME The RENAME forms change the name of a foreign table or the name of an individual column in a foreign table. SET SCHEMA This form moves the foreign table into another schema. OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) Change options for the foreign table or one of its columns. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified. Duplicate option names are not allowed (although it's OK for a table option and a column option to have the same name). Option names and values are also validated using the foreign data wrapper library. All the actions except RENAME and SET SCHEMA can be combined into a list of multiple alterations to apply in parallel. For example, it is possible to add several columns and/or alter the type of several columns in a single command. You must own the table to use ALTER FOREIGN TABLE. To change the schema of a foreign table, you must also have CREATE privilege on the new schema. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the table's schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the table. However, a superuser can alter ownership of any table anyway.) To add a column or alter a column type, you must also have USAGE privilege on the data type. PARAMETERS
name The name (possibly schema-qualified) of an existing foreign table to alter. column_name Name of a new or existing column. new_column_name New name for an existing column. new_name New name for the table. data_type Data type of the new column, or new data type for an existing column. CASCADE Automatically drop objects that depend on the dropped column (for example, views referencing the column). RESTRICT Refuse to drop the column if there are any dependent objects. This is the default behavior. new_owner The user name of the new owner of the table. new_schema The name of the schema to which the table will be moved. NOTES
The key word COLUMN is noise and can be omitted. Consistency with the foreign server is not checked when a column is added or removed with ADD COLUMN or DROP COLUMN, a NOT NULL constraint is added, or a column type is changed with SET DATA TYPE. It is the user's responsibility to ensure that the table definition matches the remote side. Refer to CREATE FOREIGN TABLE (CREATE_FOREIGN_TABLE(7)) for a further description of valid parameters. EXAMPLES
To mark a column as not-null: ALTER FOREIGN TABLE distributors ALTER COLUMN street SET NOT NULL; To change options of a foreign table: ALTER FOREIGN TABLE myschema.distributors OPTIONS (ADD opt1 'value', SET opt2, 'value2', DROP opt3 'value3'); COMPATIBILITY
The forms ADD, DROP, and SET DATA TYPE conform with the SQL standard. The other forms are PostgreSQL extensions of the SQL standard. Also, the ability to specify more than one manipulation in a single ALTER FOREIGN TABLE command is an extension. ALTER FOREIGN TABLE DROP COLUMN can be used to drop the only column of a foreign table, leaving a zero-column table. This is an extension of SQL, which disallows zero-column foreign tables. PostgreSQL 9.2.7 2014-02-17 ALTER FOREIGN TABLE(7)
Man Page