I am learning Postgres and trying a create command. But it is giving error which I am unable to understand which is making error. The command is :
CREATE TABLE Package (
id smallint NOT NULL primary key,
package_name varchar ( 45 ) not null,
updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP,
count integer(2) default null,
pkg_desc varchar ( 45 ) not null,
bucket_name varchar ( 45 ) not null,
active bit(1),
status INT(2) default null,
metadata JSONB,
path varchar ( 45 ) default null,
created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP,
run_status INT(5)
)
And the error:
ERROR: syntax error at or near "("
Position: 186
You use
integer(2)
and INT(2)
to create a column. You must not add the number. Integers are fixed size. Also you should decide on one way to write it Try this: