Salve a tutti e scusate l'OT,
Sapete dirmi come si altera una tabella in
un database postgres???
Ho la necessita' di allargare o restringere una
colonna, ho provato

Alter table <nome_tabella> modify <nome_colonna> <nuovo_valore>;

ma non acetta modify!!!

Ciao,


prova con RENAME . Quello che metto di seguito l'ho trovato in:

http://jamesthornton.com/postgres/7.2/postgres/sql-altertable.html

ALTER TABLE
Name
ALTER TABLE  --  change the definition of a table
Synopsis

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 Inputs


table

The name of an existing table to alter.
column

Name of a new or existing column.
type

Type of the new column.
newcolumn

New name for an existing column.
new_table

New name for the table.
table_constraint_definition

New table constraint for the table
new_owner

The user name of the new owner of the table.

Ciao Andrea



Rispondere a