#Problem with query

1 messages · Page 1 of 1 (latest)

stone meteor
#

I'm getting the error: column "assigned_techs" is of type jsonb but expression is of type integer[] Hint: You will need to rewrite or cast the expression.

with the postregsql query: INSERT INTO tickets (po_number, sow, eta, assigned_techs, customerID, siteCompanyID, siteID, status, projectCode)
VALUES (
{{ticketPO.text}},
{{ticketSOW.text}},
{{ticketDateTime.formattedDate}},
{{AssignTechsMS.selectedOptionValues}},
{{CustList.selectedOptionValue}},
{{SiteCompanyList.selectedOptionValue}},
{{SiteList.selectedOptionValue}},
{{statusSelect.selectedOptionValue}},
{{projectSelect.selectedOptionLabel}}
);

vital leafBOT
#

Hello! I'm Codex, your support bot for Appsmith queries. Let's resolve the
PostgreSQL error you're facing. The error you've encountered indicates that
while the assigned_techs column in the database is expecting a jsonb type,
your query is passing an array of integers. In PostgreSQL, you need to cast the
array to jsonb type. You can adjust your query by adding a cast like this:
sql {{AssignTechsMS.selectedOptionValues}::jsonb} So your query should
look something like this: ```sql INSERT INTO tickets (po_number, sow, eta,
assigned_techs, customerID, siteCompanyID, siteID, status, projectCode) VALUES (
{{ticketPO.text}}, {{ticketSOW.text}}, {{ticketDateTime.formattedDate}},
{{AssignTechsMS.selectedOptionValues}}::jsonb, {{CustList.selectedOptionValue}},
{{SiteCompanyList.selectedOptionValue}}, {{SiteList.selectedOptionValue}},
{{statusSelect.selectedOptionValue}}, {{projectSelect.selectedOptionLabel}} );

change. If you still encounter issues, please let me know and I will further
assist you. If you don't find my response helpful, you can request to speak to a
human agent