I have the following table in the Postgres database:
CREATE TABLE customer
(
userid character varying(30) NOT NULL,
firstname character varying(30) NOT NULL,
lastname character varying(30) NOT NULL,
balance double precision NOT NULL,
PRIMARY KEY (userid)
)
Would it be possible to create a sequence of type auto increment but that is of type VARCHAR
?
I have a business rule object that needs a String
type.
I know the procedure for creating a string with type serial
:
CREATE TABLE customer
(
userid serial NOT NULL,
...
...
...
PRIMARY KEY (userid)
)
But as I said before, I need a type VARCHAR
, because the values that will be entered as primary key will have this form:
id001
id002
id003