Re: BUG #19033: Inconsistency between prepared statement and normal statement when cast bit to integer - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #19033: Inconsistency between prepared statement and normal statement when cast bit to integer
Date
Msg-id 1393031.1756306495@sss.pgh.pa.us
Whole thread Raw
In response to BUG #19033: Inconsistency between prepared statement and normal statement when cast bit to integer  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> PREPARE prepare_query (unknown) AS SELECT $1::INT;
> EXECUTE prepare_query(B'1111');
> ERROR:  parameter $1 of type bit cannot be coerced to the expected type
> integer

The reason that fails is that EvaluateParams uses assignment-coercion
semantics, which is more limited in what it will allow than an
explicit coercion.  I think this is correct behavior.  The system
should not silently perform cross-type-category casts --- too much
risk of unintended results.

            regards, tom lane



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #19033: Inconsistency between prepared statement and normal statement when cast bit to integer
Next
From: Arseniy Mukhin
Date:
Subject: Re: BUG #19031: pg_trgm infinite loop on certain cases