Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XkE9K-0001sp-2y for pgsql-sql@arkaria.postgresql.org; Fri, 31 Oct 2014 15:30:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XkE9J-0006lM-4X for pgsql-sql@arkaria.postgresql.org; Fri, 31 Oct 2014 15:30:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XkE9H-0006lF-Om for pgsql-sql@postgresql.org; Fri, 31 Oct 2014 15:30:00 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XkE99-0004uW-R0 for pgsql-sql@postgresql.org; Fri, 31 Oct 2014 15:29:58 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id DC60F20778 for ; Fri, 31 Oct 2014 11:29:49 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 31 Oct 2014 11:29:49 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= x-sasl-enc:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=mesmtp; bh=zgij2sYxVvxLA10FuI6Kg9zhF+s=; b=kmqdq/Sg3rlL2gruuY CNWxn5W2JdL1b8y5xBUqMfn/odydTJqu8tMnyPQCS1uPam5+rRWEintxM7CdWTTC Q4BDhdSo4xfTaUBTAxWnPK3hloASe/o2aPwJo5ypnT69ak2JQOtn5rt55j0e/qEO m+asNX1EOZHxHWcQz2ESJm2uQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:message-id:date:from :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=zgij2sYxVvxLA10FuI6Kg9 zhF+s=; b=KFEDOWBMUruoxoHxuexHpCQyEPQKALjJAhxK8Ab73hz+xNbjGW32VH P7LxTdDSImroWLbH0es4p9rAr/gh2aRjlJ6z1q9Mr36BV3gzBoTwlJ6Hv13LyVk8 K4KnAY1DUXfX5GOy1OYzj20kOFM9YpeB2q8XoxDA31ga0Zm5eWflI= X-Sasl-enc: U31uBJhfH0LYolZVIhATs/h0OzCs/frX/hle8f+a0mQO 1414769389 Received: from [192.168.1.5] (unknown [97.113.25.101]) by mail.messagingengine.com (Postfix) with ESMTPA id 689E1C0000A; Fri, 31 Oct 2014 11:29:49 -0400 (EDT) Message-ID: <5453AAEC.8050505@aklaver.com> Date: Fri, 31 Oct 2014 08:29:48 -0700 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: =?UTF-8?B?RmlsaXAgUmVtYmlhxYJrb3dza2k=?= , Community PostgreSQL Subject: Re: INT8 / float casting question References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 10/31/2014 07:58 AM, Filip RembiaƂkowski wrote: > psql.bin (9.3.4, server 9.3.5) > Type "help" for help. > > dev=# select (2^63-1)::INT8; > ERROR: bigint out of range > > Does it HAVE to be so? > > > http://en.wikipedia.org/wiki/9223372036854775807 It seems to be not a problem with the number but the exponentiation and casting: test=# create table bigint_test (int_fld int8); CREATE TABLE test=# insert into bigint_test values (9223372036854775807); INSERT 0 1 test=# select * from bigint_test ; int_fld --------------------- 9223372036854775807 test=# select 2^63-1; ?column? ---------------------- 9.22337203685478e+18 (1 row) test=# select (2^63-1)::int8; ERROR: bigint out of range > > > > Thanks > Filip > > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql