X-Original-To: pgsql-sql@postgresql.org Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by postgresql.org (Postfix) with ESMTP id E14944762E0 for ; Mon, 17 Mar 2003 15:35:06 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 18v1K7-0002vX-0d; Mon, 17 Mar 2003 20:35:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id B88D116E24; Mon, 17 Mar 2003 20:35:06 +0000 (GMT) Received: from archonet.com (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with SMTP id 2BB3716E22; Mon, 17 Mar 2003 20:35:06 +0000 (GMT) Received: from 192.168.1.32 (SquirrelMail authenticated user dev) by mainbox.archonet.com with HTTP; Mon, 17 Mar 2003 20:35:06 -0000 (GMT) Message-ID: <49174.192.168.1.32.1047933306.squirrel@mainbox.archonet.com> In-Reply-To: <037901c2ecc2$cea38a30$3dc810ac@corphq.psynapsetech.net> References: <037901c2ecc2$cea38a30$3dc810ac@corphq.psynapsetech.net> Date: Mon, 17 Mar 2003 20:35:06 -0000 (GMT) Subject: Re: upcasting multiplication in a query From: dev@archonet.com To: "John Guthrie" Cc: pgsql-sql@postgresql.org X-Mailer: SquirrelMail (version 1.3.2) MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-Virus-Scanned: by AMaViS snapshot-20020531 X-Archive-Number: 200303/418 X-Sequence-Number: 12457 > i have a schema that stores timestamps in seconds/microseconds format. > each > column in the table is int4. what i want to do is to compute the int8 > value > of total microseconds, a la: > select (seconds*1000000)+micros from my_table; > but it looks to me like postgresql puts the rresult into another int4 > (since > i am getting negative numbers, i assume overflow). how can i get it to use > int8? Try (seconds::int8 * 10000000)+micros - you could use cast(...) if you want to be more standard. - Richard Huxton