postgres=# CREATE TABLE x (
postgres(# id SERIAL PRIMARY KEY,
postgres(# content VARCHAR(255) DEFAULT NULL
postgres(# );
NOTICE: CREATE TABLE will CREATE implicit SEQUENCE "x_id_seq" FOR serial COLUMN "x.id"
NOTICE: CREATE TABLE / PRIMARY KEY will CREATE implicit INDEX "x_pkey" FOR TABLE "x"
CREATE TABLE
postgres=# \d x
TABLE "public.x"
COLUMN | TYPE | Modifiers
---------+------------------------+------------------------------------------------
id | INTEGER | NOT NULL DEFAULT NEXTVAL('x_id_seq'::regclass)
content | CHARACTER VARYING(255) | DEFAULT NULL::CHARACTER VARYING
Indexes:
"x_pkey" PRIMARY KEY, btree (id)
postgres=# ALTER TABLE x RENAME TO y;
ALTER TABLE
postgres=# \d y
TABLE "public.y"
COLUMN | TYPE | Modifiers
---------+------------------------+------------------------------------------------
id | INTEGER | NOT NULL DEFAULT NEXTVAL('x_id_seq'::regclass)
content | CHARACTER VARYING(255) | DEFAULT NULL::CHARACTER VARYING
Indexes:
"x_pkey" PRIMARY KEY, btree (id)