Postgresql primary key not auto incrementing even when notation serial specified this is my table create script
CREATE TABLE public."Medication" (
"Id" serial NOT NULL,
"ResidentId" int4 NOT NULL,
"PharmacyId" int4 NULL,
"PhysicianId" int4 NULL,
"ReleasedQty" float8 NOT NULL DEFAULT '0'::double precision,
"PRNEffectiveTime" int4 NULL,
"IsSTO" bool NOT NULL DEFAULT false,
"IsPendingOrder" bool NOT NULL DEFAULT false,
"IsPsychotropic" bool NOT NULL DEFAULT false,
"IsINRRequired" bool NOT NULL DEFAULT false,
"eSignature" varchar NULL,
"eSignatureDate" timestamp NULL,
"PhysicianId_X" int4 NULL,
"IsWitnessSigReq" bool NULL,
"IsInjection" bool NULL,
"AdministerByRole" varchar NULL,
"AdministerByUser" varchar NULL,
"AlfId" int4 NOT NULL,
CONSTRAINT "Medication_pkey" PRIMARY KEY ("Id", "AlfId")
)
PARTITION BY RANGE ("AlfId");
the value of Id always remains zero
0into that column.