Saving rgb color in PostgreSQL

Saving rgb color in PostgreSQL
0

#1

Hey folks,
I created a table to save tasks, and one of the columns is color. When I save default value it’s ok, but whenever I want to update the value to a different rgb color it says:

invalid input syntax for integer: “rgb(74,125,62)”

I tried VARCHAR too, but I got the same error. I would rather avoid creating 3 columns like red, green, blue. Is there any other way to save the rgb color in the column?

color CHAR(255) DEFAULT 'rgb(74,125,62)',

#2

and your input type is??


#3

it’s a string, if that’s what you mean


#4

then maybe is something wrong with your inserting/updating sql code