Michael Glaesemann <grzm@myrealbox.com> writes:
> Except, why doesn't it work in the CREATE TABLE statement?
The UNIQUE/PRIMARY KEY syntax only allows bare column names, per the SQL
standard. While there's not any technical reason why we couldn't extend
that syntax, there's a pretty large fear factor involved: we could find
ourselves behind the spec-compliance eight-ball if the SQL committee
exercises their prerogative to extend the syntax in some other
direction. CREATE INDEX is entirely outside the spec (as the whole
concept of indexes is outside the spec) and so we can pretty much do
what we please within that statement.
This is exactly the same reason why we don't support opclass names in
UNIQUE/PRIMARY KEY, as has been suggested several times recently, eg
http://archives.postgresql.org/pgsql-hackers/2006-03/msg00163.php
regards, tom lane