0

I'm getting an error when uploading to an asset field from a front end form during entry creation.

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type integer: "Screen Shot 2021-09-01 at 12.42.42 PM.png"
LINE 14: ... 3, 20, 1, 15, 7, 8, 19)) AND ("subElements"."id"='Screen Sh...
^
The SQL being executed was: SELECT EXISTS(SELECT "elements"."id", "elements"."fieldLayoutId", "elements"."uid", "elements"."enabled", "elements"."archived", "elements"."dateCreated", "elements"."dateUpdated", "elements_sites"."id" AS "siteSettingsId", "elements_sites"."slug", "elements_sites"."siteId", "elements_sites"."uri", "elements_sites"."enabled" AS "enabledForSite", "assets"."volumeId", "assets"."folderId", "assets"."filename", "assets"."kind", "assets"."width", "assets"."height", "assets"."size", "assets"."focalPoint", "assets"."keptFile", "assets"."dateModified", "volumeFolders"."path" AS "folderPath", "assets"."uploaderId", "content"."id" AS "contentId", "content"."title", "content"."field_availableActions", "content"."field_address1", "content"."field_address2", "content"."field_moderationStatus", "content"."field_ageOfFirstArrest", "content"."field_userAgency", "content"."field_agreementText", "content"."field_appointmentDay", "content"."field_appointmentTime", "content"."field_authorizationInstructions", "content"."field_authorizationLanguage", "content"."field_badgeNumber", "content"."field_bodyPlain", "content"."field_citationInformation", "content"."field_citationStatus", "content"."field_city", "content"."field_proxyComments", "content"."field_county", "content"."field_siteCounty", "content"."field_courtCase", "content"."field_currentAge", "content"."field_currentGrade", "content"."field_dob", "content"."field_siteDarkColor", "content"."field_customTask", "content"."field_driverLicense", "content"."field_dueDate", "content"."field_enableExternalSubmissions", "content"."field_ethnicity", "content"."field_eyeColor", "content"."field_failureLetterContent", "content"."field_gender", "content"."field_genderJuvenile", "content"."field_hairColor", "content"."field_height", "content"."field_hours", "content"."field_irc", "content"."field_inPersonHours", "content"."field_informationVerified", "content"."field_invoiceDueDate", "content"."field_invoiceInstallments", "content"."field_invoiceTotal", "content"."field_ipAddress", "content"."field_ltvHostId", "content"."field_ltvJoinUrl", "content"."field_ltvParticipantId", "content"."field_ltvResponse", "content"."field_ltvSessionId", "content"."field_legalReference", "content"."field_letterBody", "content"."field_letterBodyFailureToContact", "content"."field_letterBodySuccessful", "content"."field_letterFoot", "content"."field_letterHead", "content"."field_letterSignoff", "content"."field_message", "content"."field_middleInitial", "content"."field_narrative", "content"."field_numberOfPriorArrests", "content"."field_offenseInformation", "content"."field_officerSignature", "content"."field_offlineMode", "content"."field_offlinePaymentAmount", "content"."field_offlinePaymentTypes", "content"."field_otherPhone", "content"."field_paidInFullReceipt", "content"."field_parentContactNumber", "content"."field_parentContactNumberAlt", "content"."field_parentDl", "content"."field_parentFirstName", "content"."field_parentLastName", "content"."field_participantInformation", "content"."field_participantSignature", "content"."field_passport", "content"."field_paymentNotes", "content"."field_paymentSuccessMessage", "content"."field_paymentWaived", "content"."field_cellNumber", "content"."field_sitePrimaryColor", "content"."field_proxyScore", "content"."field_quantity", "content"."field_race", "content"."field_relationshipToYouth", "content"."field_requestDemoUrl", "content"."field_requireEmail", "content"."field_revisionNotes", "content"."field_seo", "content"."field_ssn", "content"."field_school", "content"."field_svProviderParticipationId", "content"."field_svProviderConnectCode", "content"."field_sessionNotes", "content"."field_sessionNotesMulti", "content"."field_sessionService", "content"."field_sessionStatus", "content"."field_siteAccess", "content"."field_siteLogoName", "content"."field_source", "content"."field_siteState", "content"."field_state", "content"."field_statute", "content"."field_stepDueDate", "content"."field_stepNotes", "content"."field_stepStatus", "content"."field_stripePlanId", "content"."field_stripeProductId", "content"."field_stripePublicKey", "content"."field_stripeSecretKey", "content"."field_stripeSubId", "content"."field_stripeCardBrand", "content"."field_stripeCardId", "content"."field_stripeCustomerId", "content"."field_stripeExpMonth", "content"."field_stripeExpYear", "content"."field_stripeInvoice", "content"."field_stripeLast4", "content"."field_studentId", "content"."field_successLetterContent", "content"."field_taskVerification", "content"."field_termsAndConditions", "content"."field_timeZone", "content"."field_userTitle", "content"."field_updatedEmail", "content"."field_verifiedBy", "content"."field_waiverApplication", "content"."field_waiver", "content"."field_waiverDecision", "content"."field_waiverNewTotal", "content"."field_waiverSubmitted", "content"."field_weight", "content"."field_zip"
FROM (SELECT "elements"."id" AS "elementsId", "elements_sites"."id" AS "elementsSitesId", "content"."id" AS "contentId"
FROM "craft_elements" "elements"
INNER JOIN "craft_assets" "assets" ON "assets"."id" = "elements"."id"
INNER JOIN "craft_volumefolders" "volumeFolders" ON "volumeFolders"."id" = "assets"."folderId"
INNER JOIN "craft_elements_sites" "elements_sites" ON "elements_sites"."elementId" = "elements"."id"
INNER JOIN "craft_content" "content" ON ("content"."elementId" = "elements"."id") AND ("content"."siteId" = "elements_sites"."siteId")
WHERE ("elements_sites"."siteId" IN (21, 2, 3, 20, 1, 15, 7, 8, 19)) AND ("elements"."id"='Screen Shot 2021-09-01 at 12.42.42 PM.png') AND ("elements"."archived"=FALSE) AND ("elements"."dateDeleted" IS NULL) AND ("elements"."draftId" IS NULL) AND ("elements"."revisionId" IS NULL) AND ("elements_sites"."id" = (SELECT "elements_sites"."id"
FROM "craft_elements" "subElements"
INNER JOIN "craft_assets" "assets" ON "assets"."id" = "subElements"."id"
INNER JOIN "craft_volumefolders" "volumeFolders" ON "volumeFolders"."id" = "assets"."folderId"
INNER JOIN "craft_elements_sites" "elements_sites" ON "elements_sites"."elementId" = "subElements"."id"
INNER JOIN "craft_content" "content" ON ("content"."elementId" = "subElements"."id") AND ("content"."siteId" = "elements_sites"."siteId")
WHERE ("elements_sites"."siteId" IN (21, 2, 3, 20, 1, 15, 7, 8, 19)) AND ("subElements"."id"='Screen Shot 2021-09-01 at 12.42.42 PM.png') AND ("subElements"."archived"=FALSE) AND ("subElements"."dateDeleted" IS NULL) AND ("subElements"."draftId" IS NULL) AND ("subElements"."revisionId" IS NULL) AND ("subElements"."id" = "elements"."id")
ORDER BY case when "elements_sites"."siteId" = 15 then 0 else 1 end, "elements_sites"."id"
LIMIT 1))
ORDER BY CASE WHEN "elements"."id"='Screen Shot 2021-09-01 at 12.42.42 PM.png' THEN 0 ELSE 1 END) "subquery"
INNER JOIN "craft_assets" "assets" ON "assets"."id" = "subquery"."elementsId"
INNER JOIN "craft_volumefolders" "volumeFolders" ON "volumeFolders"."id" = "assets"."folderId"
INNER JOIN "craft_elements" "elements" ON "elements"."id" = "subquery"."elementsId"
INNER JOIN "craft_elements_sites" "elements_sites" ON "elements_sites"."id" = "subquery"."elementsSitesId"
INNER JOIN "craft_content" "content" ON "content"."id" = "subquery"."contentId"
ORDER BY CASE WHEN "elements"."id"='Screen Shot 2021-09-01 at 12.42.42 PM.png' THEN 0 ELSE 1 END)

In the above stack trace, "Screen Shot..." is the file name. Uploading any file returns the same error, with the file name appearing there.

This error only occurs when using the front end form during entry creation. File uploads from the back end work fine and using the front end form to edit an existing entry works fine as well.

I'm running Craft 3.5.1 on PostgreSQL 13.

I was previously running on Craft 3.4 when I found this issue: Bug when saving elements that contain an asset in PostgreSQL

At that point, I upgraded to 3.5.1 hoping that would resolve the issue, but it has not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.