Add column-name hint to log messages generated by inserts when varchars don't fit - Mailing list pgsql-hackers

From Stepan Rutz
Subject Add column-name hint to log messages generated by inserts when varchars don't fit
Date
Msg-id trinity-1d932224-266a-4105-af4a-991894a66e9f-1438770248753@3capp-gmx-bs13
Whole thread Raw
List pgsql-hackers
<div style="font-family: Verdana;font-size: 12.0px;"><div><div>Hi everybody again,</div><div>on our production servers
Ihave quite some errors due to excessively long varchar-values which application-code tries to insert into tables and
whichdon't fit.<br /> The tables have many columns, the statements are not readable and many columns happen to have the
samelength. Powers of 2 most often for some odd reason ...</div><div>I fired up gdb and saw that the error message is
generatedduring the preprocessing of the query where some kind of the constant-folding/constant-elimination happens on
theparse-tree. I went ahead and added a try/catch at some point upwards in the call-stack where at least i have the
contactof the T_TargetEntry. That has a field resname which gives me exactly the information i need... The column which
wasoverflown. With that info i can fix the application code much more easily. Relation name was out of reach for me,
thereis a void* passed transparently to the constant-mutator but that is not checkable at the point. That context
containsthe original top-level statement node however.</div><div>The patch just adds a bit of hinting to the error
messageand goes on.. That is all but really helpful to me and potentially also others.</div><div>Attached Patch has
moreInfos and comments.</div><div><br /> Regards from Germany,</div><div>Stepan</div></div><div
class="signature">StepanRutz<br /> Phone: +49 (0) 178 654 9284<br /> Email: stepan.rutz@gmx.de<br /> Earth:
Brunnenallee25a, 50226 Frechen, Germany</div></div> 

pgsql-hackers by date:

Previous
From: Robert Abraham
Date:
Subject: Patch for ginCombineData
Next
From: "Stepan Rutz"
Date:
Subject: Add column-name hint to log messages generated by inserts when varchars don't fit