Postgresql Altering Table
Is it possible to alter a table to add a new column and make that column a foreign key to another table in a single command in Postgresql? "alter table x add column y id references z(id)" doesn't seem to work as I had hoped.
You can do it. What is "y id"? May be
alter table x add column y int references z(id)
BEGIN ALTER TABLE ... ADD COLUMN ... ALTER TABLE ... ADD CONSTRAINT ... COMMIT
You can't convince me it's not a single command :).