"coment_id references comments" is a short-hand way of declaring a column as a foreign key to the primary key of the "referenced" table. So this:
Code:
create table images (image_id integer primary key,
comment_id references comments);
is equivalent to this:
Code:
create table images (image_id integer primary key,
comment_id integer,
foreign key(comment_id) references comments (comment_id)
);
Example:
Code:
insert into comments (comment_id, comment_text)
values (123, 'This is a picture of my cat');
insert into images (image_id, image_file, comment_id)
values (456, 'mycat.jpg', 123);
Of course, this model only allows one comment per object, which may not be want you want.