gpt4 book ai didi

postgresql异常运算符不存在: uuid = bytea

转载 作者:行者123 更新时间:2023-11-29 14:33:58 26 4
gpt4 key购买 nike

嗨,在我的 spring boot postgresql 应用程序中,我想执行以下 sql 查询。

 SELECT
o.id as projectId,
o.name as projectName,
stld.name || ' ' || pe.firstname || ' ' || COALESCE(pe.middlename , ' ') || ' ' || pe.lastname as employeeName,
pemp.description as description,
pemp.actualstartdate as actualStartDate,
pemp.actualenddate as actualEndDate
FROM Con_project o
LEFT JOIN con_project_employee pemp on o.id = pemp.projectid
LEFT JOIN employee pe on pemp.employeeid = pe.id
LEFT JOIN system_type_lookup_data stld on stld.id=pe.TITLEID
WHERE
pemp.employeeid = :employeeId OR pemp.projectid =
:projectId

控制者

 @RequestMapping(value = "/employeeproject", method = RequestMethod.GET)
@ResponseBody public Page listEmployeeProject(@RequestParam UUID projectId, @RequestParam UUID employeeId, @RequestParam Integer page, @RequestParam Integer size) {
profileService.findEmployeeProject(projectId, employeeId, new PageRequest(page, size));
return null;
}

当我执行查询时,出现以下错误。 Controller 在该 Actor 中不会有 employeeId 和 projectId 我需要在没有任何过滤器的情况下获取员工项目。

.14:15:07.156 [http-nio-6062-exec-9] WARN  o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 42883 
.14:15:07.156 [http-nio-6062-exec-9] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ERROR: operator does not exist: uuid = bytea
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.

DDL

     CREATE TABLE employee
(
id uuid NOT NULL,
createdby uuid NOT NULL,
createddatetime timestamp without time zone NOT NULL,
entity_status integer,
updatedby uuid,
updateddatetime timestamp without time zone,
version bigint,
age integer,
code character varying(50),
dob timestamp without time zone,
email character varying(255),
firstname character varying(300),
lastname character varying(300),
middlename character varying(300),
mobile character varying(255),
employee_id character varying(255),
joined_date timestamp without time zone,
qualification character varying(255),
orgid uuid,
genderid uuid,
maritalstatusid uuid,
nationalityid uuid,
titleid uuid,
CONSTRAINT employee_pkey PRIMARY KEY (id),
CONSTRAINT uk_nbyivu8qgmx0r7wtbplf01gf8 UNIQUE (code)
);
CREATE TABLE con_project
(
id uuid NOT NULL,
createdby uuid NOT NULL,
createddatetime timestamp without time zone NOT NULL,
entity_status integer,
updatedby uuid,
updateddatetime timestamp without time zone,
version bigint,
code character varying(255),
description character varying(250),
name character varying(100),
actualenddate timestamp without time zone,
actualstartdate timestamp without time zone,
plannedenddate timestamp without time zone,
plannedstartdate timestamp without time zone,
projectvalue double precision,
orgid uuid,
customerid uuid,
projectmgr uuid,
CONSTRAINT con_project_pkey PRIMARY KEY (id),
CONSTRAINT fklhj0vjp9kg5ailryr38s8kbvr FOREIGN KEY (projectmgr)
REFERENCES public.employee (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);

CREATE TABLE con_project_employee
(
id uuid NOT NULL,
createdby uuid NOT NULL,
createddatetime timestamp without time zone NOT NULL,
entity_status integer,
updatedby uuid,
updateddatetime timestamp without time zone,
version bigint,
actualenddate timestamp without time zone,
actualstartdate timestamp without time zone,
description character varying(255),
orgid uuid,
employeeid uuid,
projectid uuid,
projectempstatus uuid,
CONSTRAINT con_project_employee_pkey PRIMARY KEY (id),
CONSTRAINT fk2dwlm099cuqdy0aoqh8xnxijs FOREIGN KEY (employeeid)
REFERENCES public.employee (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fkj2my042i5v8kk3h4qq96m2cl1 FOREIGN KEY (projectid)
REFERENCES public.con_project (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);

最佳答案

projectIdemployeeIdnull 时,PG 告诉您 SQL 无效。

关于postgresql异常运算符不存在: uuid = bytea,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47749371/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com