Any hope for more specific error message for "value too long..."? - Mailing list pgsql-general

From Ken Tanzer
Subject Any hope for more specific error message for "value too long..."?
Date
Msg-id CAD3a31WR8X1TpjR_MoZxuz4S0BO3ZkPAeLoQ9rPxKHG=728eoQ@mail.gmail.com
Whole thread Raw
Responses Re: Any hope for more specific error message for "value too long..."?
Re: Any hope for more specific error message for "value too long..."?
Re: Any hope for more specific error message for "value too long..."?
List pgsql-general
Hi.  If you try to assign a too-long string to a field, Postgresql will say so, but won't tell you which value/field is causing the problem:

CREATE TEMP TABLE foo (a VARCHAR(2)); 
INSERT INTO foo VALUES ('ABC');
CREATE TABLE
ERROR:  value too long for type character varying(2)

That doesn't matter much in a simple example like that, but the example below is currently making me wish PG was just a little bit more specific.  Is there much chance of this changing in future releases?

Cheers,
Ken

INSERT INTO tbl_membership_info  (client_id,membership_info_date,survey_schedule_code,hs_homeless_past_code,hs_homeless_past_skip_code,hs_live_last_30_code,hs_live_last_30_skip_code,hs_live_last_30_institution,hs_live_last_30_other,hs_live_satisfied_code,hs_live_satisfied_skip_code,hs_live_improve_code,hs_live_improve_skip_code,hs_rc_help_improve_code,hs_rc_help_improve_skip_code,hs_rc_help_maintain_code,hs_rc_help_maintain_skip_code,da_desire_recovery_code,da_desire_recovery_skip_code,da_rc_desire_recovery_code,da_rc_desire_recovery_skip_code,da_in_recovery_alcohol_code,da_in_recovery_alcohol_skip_code,da_30_alcohol_days,da_30_alcohol_days_skip_code,da_rc_prevent_alcohol_relapse_code,da_rc_prevent_alcohol_relapse_skip_code,da_rc_prevent_alcohol_relapse_how,da_in_recovery_drug_code,da_in_recovery_drug_skip_code,da_30_drug_days,da_30_drug_days_skip_code,da_rc_prevent_drug_relapse_code,da_rc_preve
 nt_drug_relapse_skip_code,da_rc_prevent_drug_relapse_how,da_in_recovery_affliction_codes,da_in_recovery_affliction_other,da_in_recovery_affliction_skip_code,hmh_overall_physical_code,hmh_overall_physical_skip_code,hmh_physical_care_where_code,hmh_physical_care_where_other,hmh_physical_care_where_skip_code,hmh_physical_care_er_90_days,hmh_physical_care_er_90_days_skip_code,hmh_physical_improve_code,hmh_physical_improve_skip_code,hmh_rc_physical_improve_code,hmh_rc_physical_improve_skip_code,hmh_overall_mh_code,hmh_overall_mh_skip_code,hmh_mh_care_where_code,hmh_mh_care_where_other,hmh_mh_care_where_skip_code,hmh_mh_care_er_90_days,hmh_mh_care_er_90_days_skip_code,hmh_rc_mh_improve_code,hmh_rc_mh_improve_skip_code,hmh_rc_mh_stabilize_code,hmh_rc_mh_stabilize_skip_code,hmh_rc_access_resource_type_codes,hmh_rc_access_resource_type_other,hmh_rc_access_resource_type_skip_code,ad_hope_code,ad_hope_skip_code,ad_rc_assist_hope_code,ad_rc_assist_hope_skip_code,ad_cope_code,ad_cope_ski
 p_code,ad_rc_assist_cope_code,ad_rc_assist_cope_skip_code,ad_connected_code,ad_connected_skip_code,ad_rc_rc_connected_code,ad_rc_rc_connected_skip_code,ad_rc_circle_connected_code,ad_rc_circle_connected_skip_code,ad_rc_connection_type_codes,ad_rc_connection_type_other,ad_rc_connection_type_skip_code,comment,added_by,changed_by,sys_log,changed_at) VALUES ('3220','2017-12-26','T4','YES',NULL,'SUBSIDIZED',NULL,NULL,NULL,'YES',NULL,'YES_ALITTLE',NULL,'NONE',NULL,'YES_ALITTLE',NULL,'HIGH',NULL,'YES_ALITTLE',NULL,'YES',NULL,'10',NULL,'NO',NULL,NULL,NULL,'NO_ANSWER',NULL,'NO_ANSWER',NULL,'NO_ANSWER',NULL,NULL,NULL,'NO_ANSWER','GOOD',NULL,'DOCTOR',NULL,NULL,NULL,'NO_ANSWER','SOMEWHAT',NULL,'MEDIUM',NULL,'FAIR',NULL,'COUNSELOR',NULL,NULL,NULL,'NO_ANSWER','MEDIUM',NULL,'YES',NULL,NULL,NULL,'NO_ANSWER','HIGH',NULL,'NEUTRAL',NULL,'FAIR',NULL,'NEUTRAL',NULL,'SOMEWHAT',NULL,'VERY',NULL,'SOMEWHAT',NULL,'{SUPPORT_12,SUPPORT_AA}',NULL,NULL,NULL,'537','537',NULL,CURRENT_TIMESTAMP)  RETURNING
 * The PostgreSQL server reported an error.
The error text was: ERROR:  value too long for type character varying(10)





--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: Trigger (or something similar) on table rename?
Next
From: Tom Lane
Date:
Subject: Re: Trigger (or something similar) on table rename?