Re: SELECT CAST(123 AS char) -> 1 - Mailing list pgsql-general

From Dean Gibson (DB Administrator)
Subject Re: SELECT CAST(123 AS char) -> 1
Date
Msg-id 47B25BC6.1080702@ultimeth.com
Whole thread Raw
In response to Re: SELECT CAST(123 AS char) -> 1  (Ken Johanson <pg-user@kensystem.com>)
Responses Re: SELECT CAST(123 AS char) -> 1
List pgsql-general
On 2008-02-12 16:17, Ken Johanson wrote:
> Dean Gibson (DB Administrator) wrote:
> ...
>
> I'm guessing you declare an explicit length of 1 (for portability), or
> do you "CAST (x as char)"? And one might ask in what context we'd need
> CHAR(1) on a numeric type, or else if substr/ing or left() make the
> code more readable for other data types..
>

Actually, I just write "CHAR" for a length of 1.

> > What is wrong with using VARCHAR for your
> purpose????????????????????????????
>
> Simply that a commonly used database (my) does not support it.

By "my", do you mean "MySQL", or "MyDatabase"?  If the latter, then
while it's your business decision  (and/or that of your customers), the
availability of decent, free databases should make a compelling case for
anyone using anything else, to migrate (and never look back) to
something full-featured.

It's like requiring portable C code to use the old, pre-ANSI style of
function declarations, because some old C compilers might not support
the ANSI style.  I think Richard Stallman of the FSF takes that
position, but I don't know of anyone else (although I'm sure there are
exceptions).

--
Mail to my list address MUST be sent via the mailing list.
All other mail to my list address will bounce.


pgsql-general by date:

Previous
From: Ken Johanson
Date:
Subject: Re: SELECT CAST(123 AS char) -> 1
Next
From: Andy Colson
Date:
Subject: Re: Storing images as BYTEA or large objects