Re: Different cast behavior of TEXT and VARCHAR

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: tomas(at)tuxteam(dot)de
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Different cast behavior of TEXT and VARCHAR
Date: 2011-04-12 14:29:44
Message-ID: 9587.1302618584@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

tomas(at)tuxteam(dot)de writes:
> When PREPARing statements, the type guessing machinery seems to behave
> differently for VARCHAR and TEXT. Is this intentional?

Your example works for me, in all branches back to 8.2:

regression=# create table foo(a text, b varchar);
CREATE TABLE
regression=# PREPARE s1 AS SELECT a, b FROM foo WHERE a = $1;
PREPARE
regression=# PREPARE s2 AS SELECT a, b FROM foo WHERE b = $1;
PREPARE

I wonder if you have some nondefault operators installed that are making
the query ambiguous.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-04-12 14:46:11 Re: What is the difference between these queries
Previous Message Merlin Moncure 2011-04-12 13:57:45 Re: PostgreSQL backend process high memory usage issue