我有这个查询只选择两个日期之间的差异:
select date_part('day', 'toDate' - 'fromDate') from "Reservation" where "reservationID" = 1;
但是这给了我这个错误:
运营商不是唯一的。无法选择最佳候选运营商。 您可能需要添加显式类型转换。
我该如何解决这个问题?
P.S。这就是我创建"预订"表:
CREATE TABLE "Reservation"
(
"reservationID" serial NOT NULL,
"fromDate" timestamp without time zone NOT NULL DEFAULT '- infinity'::timestamp without time zone,
"toDate" timestamp without time zone NOT NULL DEFAULT '-infinity'::timestamp without time zone,
"staffID" integer NOT NULL DEFAULT 0,
"customerID" integer NOT NULL DEFAULT 0,
"roomID" integer NOT NULL DEFAULT 0,
CONSTRAINT "PK_public.Reservation" PRIMARY KEY ("reservationID"),
CONSTRAINT "FK_public.Reservation_public.Customer_customerID" FOREIGN KEY ("customerID")
REFERENCES "Customer" ("customerID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT "FK_public.Reservation_public.Room_roomID" FOREIGN KEY ("roomID")
REFERENCES "Room" ("roomID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT "FK_public.Reservation_public.Staff_staffID" FOREIGN KEY ("staffID")
REFERENCES "Staff" ("staffID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
)
答案 0 :(得分:3)
您无法使用void updateMatrix(double ***mat, int size, double *vec)
{ // mat is sizeXsize matrix, length of vec is size+1
*mat = (double**)realloc(*mat, (size + 1)*sizeof(double*));
(*mat)[size] = (double*)malloc((size + 1)*sizeof(double));
for(int i = 0; i < size + 1; i++) {
(*mat)[size][i] = vec[i];
}
for(int i = 0; i < size; i++) {
(*mat)[i] = (double*)realloc((*mat)[i], (size + 1)*sizeof(double));
(*mat)[i][size] = vec[i];
}
}
代替'
列名称
"