X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3937AD1B4E3 for ; Tue, 21 Oct 2003 18:55:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 27432-06 for ; Tue, 21 Oct 2003 15:54:54 -0300 (ADT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id ECD65D1B527 for ; Tue, 21 Oct 2003 15:54:36 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1AC1eL-0001bH-0Z; Tue, 21 Oct 2003 19:54:33 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 77F231791B; Tue, 21 Oct 2003 19:54:32 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id C7D551791A; Tue, 21 Oct 2003 19:54:31 +0100 (BST) From: Richard Huxton To: Wilhelm Graiss , "'pgsql-sql@postgresql.org'" Subject: Re: plpgsql related question: intervals and variables Date: Tue, 21 Oct 2003 19:54:30 +0100 User-Agent: KMail/1.5 References: <40925A3BA1EBD711A35C000102B6E57D06C9A7@BAL_PROXY00> In-Reply-To: <40925A3BA1EBD711A35C000102B6E57D06C9A7@BAL_PROXY00> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310211954.30195.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/275 X-Sequence-Number: 15675 On Tuesday 21 October 2003 14:58, Wilhelm Graiss wrote: > heute := ''today''; > Select Into vk ourcolumn From table where other = foo; > If vk > 0 Then > vk_txt := ''Vorkuehlung notwendig''; > ez := heute + interval ''vk days''; > The variable 'heute' is declared as timestamp, > 'vk' as integer! > > What have we done wrong?? Quoted the vk variable. You want something like: ez := heute + (vk || '' days'')::interval; -- Richard Huxton Archonet Ltd