Re: Different cast behavior of TEXT and VARCHAR

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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Apr 12, 2011 at 10:29:44AM -0400, Tom Lane wrote:
> 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

Thanks!

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

That would mean I managed to munge my template1. Yes, that'd be the most
plausible scenario :-/

Not at my machine at the moment, will check later. Thanks and sorry for
the noise.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFNpGgLBcgs9XrR2kYRAgU5AJwJnOwC0LYHAiPUC9jWASI+al95owCdGhqX
EoRE7s265qjLz1yJBMERrQI=
=AnaI
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message tv 2011-04-12 15:12:16 Re: What is the difference between these queries
Previous Message Tom Lane 2011-04-12 14:46:11 Re: What is the difference between these queries