Curious as to why not simply use UUIDs instead?
Its extremely easy to use uuids as the primary key; make the column a `uuid` type and the `uuid-ossp` extension will generate them. Your sql would look like:
CREATE TABLE posts (
post_id uuid DEFAULT uuid_generate_v4(),
PRIMARY_KEY(post_id)
);