On PostgresSQL 12.2, running on macOS Catalina (10.15.4), have the following DB Schema:
CREATE TABLE public.reservation
(
id integer,
name character varying(255) COLLATE pg_catalog."default"
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.reservation
OWNER to postgres;
Here's listing the relations:
orders=# \d
List of relations
Schema | Name | Type | Owner
--------+-------------+-------+----------
public | reservation | table | postgres
(1 row)
After conducting the following inserts:
INSERT INTO reservation(name) VALUES('Michael');
INSERT INTO reservation(name) VALUES('Vito');
INSERT INTO reservation(name) VALUES('Sonny');
INSERT INTO reservation(name) VALUES('Fredo');
Then, checking the results:
SELECT * FROM reservation;
Receive the following output:
id | name
----+--------
| Michael
| Vito
| Sonny
| Fredo
(4 rows)
How can I modify this table's structure (using DDL) to have it auto-increment ids with values?
255for a varchar column has no performance or storage advantage over 250, 263 or 3876