I want to create multiple image paths based on the language and size of the image. I decided to CREATE TYPE and then use it in the table.
CREATE DATABASE asset ( id bigserial not null constraint primary key, main_image img ); CREATE TYPE img AS ( lang varchar(2) not null, size varchar(32) not null, img_path varchar(255) not null );
How do I make something like this: unique(lang, size) for my composite type? I want this combo to be unique.
How do I restrict any inserts that try to add an img_path for lang & size combo that already has img_path defined? I have tried to CREATE DOMAIN, but it seems like it is not intended for it.