| From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> | 
|---|---|
| To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> | 
| Cc: | Alexey Bashtanov <bashtanov(at)imap(dot)cc>, Franck Verrot <franck(at)verrot(dot)fr>, pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: [PATCH]: Allow errors in parameter values to be reported during the BIND phase itself.. | 
| Date: | 2021-02-22 05:05:26 | 
| Message-ID: | 20210222050526.GA11347@telsasoft.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Mon, Jan 04, 2021 at 11:09:39AM -0600, Justin Pryzby wrote:
> For example:
> 
> $ python3.5 -c "import pg; db=pg.DB(); q = db.query(\"SET log_parameter_max_length_on_error=-1;\"); db.prepare('p', 'SELECT \$1::smallint'); db.query_prepared('p',66666);"
> 2021-01-03 02:21:04.547 CST [20157] ERROR:  value "66666" is out of range for type smallint
> 2021-01-03 02:21:04.547 CST [20157] CONTEXT:  unnamed portal with parameters: $1 = '66666'
> 2021-01-03 02:21:04.547 CST [20157] STATEMENT:  SELECT $1::smallint
> 
> When there are many bind params, this can be useful to determine which is out
> of range.  Think 900 int/smallint columns, or less-wide tables being inserted
> multiple rows at a time with VALUES(),(),()...
This fixes a crash when there are zero bind params, and the error context was
popped after not being pushed.
-- 
Justin
| Attachment | Content-Type | Size | 
|---|---|---|
| 0001-report-errors-in-parameter-values-during-BIND.patch | text/x-diff | 8.4 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2021-02-22 05:22:46 | Re: Use pgstat_progress_update_multi_param instead of single param update | 
| Previous Message | Bharath Rupireddy | 2021-02-22 04:49:32 | Re: Improvements and additions to COPY progress reporting |