Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 4E4D7476822 for ; Tue, 14 May 2002 16:26:38 -0400 (EDT) Received: from smtpout.mac.com (smtpout.mac.com [204.179.120.89]) by postgresql.org (Postfix) with ESMTP id 0C7FB47595E for ; Tue, 14 May 2002 14:56:39 -0400 (EDT) Received: from smtp-relay.mac.com (smtp-relay01-en1 [10.13.10.224]) by smtpout.mac.com (8.12.1/8.10.2/1.0) with ESMTP id g4EIudkv010788 for ; Tue, 14 May 2002 11:56:39 -0700 (PDT) Received: from asmtp01.mac.com (asmtp01-qfe3 [10.13.10.65]) by smtp-relay.mac.com (8.12.1/8.12.1/1.0) with ESMTP id g4EIuYrE003492 for ; Tue, 14 May 2002 11:56:34 -0700 (PDT) Received: from localhost ([138.88.66.115]) by asmtp01.mac.com (Netscape Messaging Server 4.15 asmtp01 Jun 21 2001 23:53:48) with ESMTP id GW47A900.M09 for ; Tue, 14 May 2002 11:56:33 -0700 Date: Tue, 14 May 2002 13:56:33 -0500 Mime-Version: 1.0 (Apple Message framework v481) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: can't cast varchar as integer? From: Scott Royston To: pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit Message-Id: <4EE21904-676C-11D6-BF4D-000393577144@mac.com> X-Mailer: Apple Mail (2.481) X-Archive-Number: 200205/140 X-Sequence-Number: 7776 Mac OSX, postgresql 7.2.1 what's the reasoning behind not being able to cast a varchar as integer? this seems very weird to me: LEDEV=# create table test (foo as varchar(5), bar as text); ERROR: parser: parse error at or near "as" LEDEV=# create table test (foo varchar(5), bar text); CREATE LEDEV=# insert into test (foo, bar) values ('123', '123'); INSERT 409490 1 LEDEV=# select * from test; foo | bar -----+----- 123 | 123 (1 row) LEDEV=# select cast(foo as integer) from test; ERROR: Cannot cast type 'character varying' to 'integer' LEDEV=# select cast(bar as integer) from test; bar ----- 123 (1 row)