Skip to content

Instantly share code, notes, and snippets.

@mlms13
mlms13 / postgresql_color_adt.sql
Last active September 19, 2017 02:32
Create a sum type for colors in sql
-- data NamedColor = Red | Green | Blue
-- data CustomColor = CustomColor
-- { r :: Int
-- , g :: Int
-- , b :: Int
-- }
-- data Color = NamedColor | CustomColor
create type custom_color as (r int, g int, b int);