BUG #17166: PREPARE without types inconsistent type resolving - Mailing list pgsql-bugs

From David G. Johnston
Subject BUG #17166: PREPARE without types inconsistent type resolving
Date
Msg-id CAKFQuwa8k=+xYTm8s36X6EEL-HyL9_LdZx8EHN57VFxABNhDzQ@mail.gmail.com
Whole thread Raw
In response to BUG #17166: PREPARE without types inconsistent type resolving  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Sunday, August 29, 2021, PG Bug reporting form <noreply@postgresql.org> wrote:
It is rather curious that a
simple order affects the type of $1. I would imagine that, as $1 IS NULL has
no type implications, the col = $1 would determine the type of $1.


The system resolves the type of each argument at its first encounter while parsing.  It has to make a choice, and since “is null” doesn’t provide any help, it is unable to make a decision.  Null “values” are still typed.

This is documented under the PREPARE SQL command reference (the only pure sql way to use numbered parameters) and so is definitely not a bug.

David J.


pgsql-bugs by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data
Next
From: PG Bug reporting form
Date:
Subject: BUG #17167: UndefinedBehaviorSanitizer: invalid-shift-exponent while running int4shr/int4shl