Re: CHAR vs TEXT args - Mailing list pgsql-general

From Joe Conway
Subject Re: CHAR vs TEXT args
Date
Msg-id 3F4D8F00.3090800@joeconway.com
Whole thread Raw
In response to CHAR vs TEXT args  (david_shadovitz@xontech.com (David Shadovitz))
List pgsql-general
David Shadovitz wrote:
> I intended to call the CHAR-signature function like this:
> SELECT ABC('R');
>
> And the TEXT-signature function like this:
> SELECT ABC('Right');
>
> But I found that both calls invoke the TEXT-signature function.  So is
> there any distinction between CHAR and TEXT?  Can I somehow specify
> that the argument 'R' is to be treated as a CHAR, so the
> CHAR-signature version of ABC is executed?

If you want to force the CHAR version, do something like:
   SELECT ABC('R'::char);

See:
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=sql-expressions.html#SQL-SYNTAX-TYPE-CASTS

HTH,

Joe


pgsql-general by date:

Previous
From: "K. Suresh"
Date:
Subject: mysql to pgsqwl migration
Next
From: Alvaro Herrera
Date:
Subject: Re: SQL Command - To List Tables ?