Serial type not working on postgres when creating a Domain?
I have run into a strange pr开发者_如何学JAVAoblem with Postgres 9 on Mac OS X, I have the following statement which works on Windows Postgres but on on Mac OS postgres
CREATE DOMAIN pkey_domain AS SERIAL PRIMARY KEY;
returns
ERROR: type "serial" does not exist
*** Error ***
ERROR: type "serial" does not exist SQL state: 42704
SERIAL is a data type that is supported by postgres why am I not able to create a Domain with it? Does the deafult installer on the Mac not create the type?
Serial isn't really a type, it is a kind of macro that creates the sequence for you, sets the default value of the column, etc. It is not referenced in pg_type. So you can't use it like this.
精彩评论