Search code examples
postgresqlsql-drop

Difference between "DROP COLUMN" and "DROP" keywords in PostgreSQL


I just noticed you can write both in PostgreSQL. Is there any difference or is it just a "simplified" syntax. As far as I know, both of these does exactly the same.

ALTER TABLE table DROP my_column;

vs

ALTER TABLE table DROP COLUMN my_column;

EDIT: I've searched around for this, but couldn't find anything. That includes the documentation.


Solution

  • According to here, COLUMN is optional i.e. the statements are equivalent. Personally, I'd keep it for clarity